Skip to content

Instantly share code, notes, and snippets.

@DubiousS
Created June 6, 2019 05:29
Show Gist options
  • Save DubiousS/ce8df4453ec668dd71690bc76867df76 to your computer and use it in GitHub Desktop.
Save DubiousS/ce8df4453ec668dd71690bc76867df76 to your computer and use it in GitHub Desktop.
export default class Card extends Component {
static Top = ({ children, ...props }) => (
<Box px={25} position="absolute" top="-20px" left="0" zIndex="1" {...props}>
{children}
</Box>
)
static Main = ({ children, ...props }) => (
<Box {...props}>{children}</Box>
)
render() {
return (
<RoundedBox position="relative" {...this.props}>
{this.props.children}
</RoundedBox>
)
}
const Test = () => (
<Card>
<Card.Top>Header</Card.Top>
<Card.Main>
<AnyComponent />
</Card.Main>
</Card>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment