[rebass] add ExtendedBox to test, add prop to CustomComponent example

This commit is contained in:
Angus Fretwell
2019-02-10 18:33:28 +11:00
parent 1ec6cdc9d2
commit 5ff828d9f0
+13 -1
View File
@@ -1,10 +1,19 @@
import * as React from "react";
import styled from "styled-components";
import { Box, Flex, Text, Heading, Button, Link, Image, Card } from "rebass";
const CustomComponent: React.FunctionComponent = ({ children }) => {
return <div>{children}</div>;
};
const ExtendedBox = styled(Box)`
color: red;
`;
ExtendedBox.defaultProps = {
p: 3
};
() => (
<Box width={1} css={{ height: "100vh" }} py={[1, 2, 3]} ml="1em">
<Flex width={1} alignItems="center" justifyContent="center">
@@ -33,10 +42,13 @@ const CustomComponent: React.FunctionComponent = ({ children }) => {
<Link href="https://rebassjs.org" title="Rebass" target="_blank">
Link
</Link>
<Box as={CustomComponent}>CustomComponent</Box>
<Button bg="magenta" border="1em" borderRadius="1em">
Button
</Button>
<Box as={CustomComponent} bg="red">
CustomComponent
</Box>
<ExtendedBox m={2}>ExtendedBox</ExtendedBox>
</Flex>
</Box>
);