import * as React from "react"; import styled from "../.."; const H1 = styled.h1` color: palevioletred; font-size: 1em; `; function getRandomInt(min: number, max: number) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; } class Random extends React.Component { render() { const i = getRandomInt(1, 6); switch (i) { case 1: return

Hello World

; case 2: return

Hello World

; case 3: return

Hello World

; case 4: return

Hello World

; case 5: return
Hello World
; case 6: return
Hello World
; default: return null; } } } const H2 = H1.withComponent("h2"); const abbr = H1.withComponent("abbr"); const Anchor = H1.withComponent("a"); const AnchorContainer = () => ( withComponent Anchor ); const RandomHeading = H1.withComponent(Random); const CompA: React.SFC<{ a: number; className?: string }> = ({ className }) => (
); const CompB: React.SFC<{ b: number; className?: string }> = ({ className }) => (
); const StyledA = styled(CompA)` color: ${(props: { color: string }) => props.color}; `; const FirstStyledA = styled(StyledA).attrs({ a: 1 })``; const FirstStyledB = FirstStyledA.withComponent(CompB); const test = () => [ , , ];