Skip to content

Commit b5f180d

Browse files
committed
refactor(Tile): handle children of Tile explicitly
1 parent 9a03814 commit b5f180d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lib/ui/components/tiles/Tile.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Element = styled.div<ElementProps>`
2222
color: ${({ theme }) => theme.titleColor};
2323
}
2424
${({ onClick, href, theme, to }) =>
25-
(onClick || href || to)
25+
onClick || href || to
2626
? `
2727
transition: box-shadow ${time.s}, transform ${time.s};
2828
&:hover {
@@ -32,18 +32,26 @@ const Element = styled.div<ElementProps>`
3232
: ``};
3333
`;
3434

35-
interface TileProps<C extends React.ElementType> {
36-
as?: C
35+
interface TileProps<C extends React.ElementType>
36+
extends React.PropsWithChildren {
37+
as?: C;
3738
space: SpaceValue;
39+
// TODO: add `to` and `href` props, but only when `as` is Link or `a`
3840
}
3941

40-
const Tile = <C extends React.ElementType = "div">({ space, ...props }: TileProps<C>) => (
42+
const Tile = <C extends React.ElementType = "div">({
43+
space,
44+
children,
45+
...props
46+
}: TileProps<C>) => (
4147
<SharedHexConsumer>
4248
{({ BIFHEX }) => (
4349
<ThemeProvider
4450
theme={{ ...whiteThm, actionColor: BIFHEX, decor: BIFHEX }}
4551
>
46-
<Element $space={space} {...props} />
52+
<Element $space={space} {...props}>
53+
{children}
54+
</Element>
4755
</ThemeProvider>
4856
)}
4957
</SharedHexConsumer>

0 commit comments

Comments
 (0)