Skip to content
This repository was archived by the owner on Mar 14, 2021. It is now read-only.

Commit 9df29a1

Browse files
author
Andrey Okonetchnikov
committed
fix: Add unique key props to lists swatches
Fixes #2
1 parent ae3ca43 commit 9df29a1

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

src/components/Colors.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ export default function Colors({ theme }) {
1212
<ThemeProvider theme={theme}>
1313
<Stack gap={gap}>
1414
<Swatches theme={theme} items={palettes}>
15-
{(key, value) => (
16-
<Stack gap={0} minWidth={100}>
17-
<PaletteSwatch token={key} value={value} />
15+
{(token, value) => (
16+
<Stack gap={0} minWidth={100} key={token}>
17+
<PaletteSwatch token={token} value={value} />
1818
</Stack>
1919
)}
2020
</Swatches>
2121
<Stack gap={gap} minWidth={150}>
2222
<Swatches theme={theme} items={colors}>
23-
{(key, value) => <ColorSwatch token={key} value={value} />}
23+
{(token, value) => (
24+
<ColorSwatch token={token} value={value} key={token} />
25+
)}
2426
</Swatches>
2527
</Stack>
2628
</Stack>

src/components/PaletteSwatch.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import { tokenPropType, valuePropType } from "../propTypes";
55

66
export const PaletteSwatch = ({ token, value }) => (
77
<Swatches items={value}>
8-
{(key, value) => <ColorSwatch value={value} token={`${token}.${key}`} />}
8+
{(key, value) => (
9+
<ColorSwatch
10+
value={value}
11+
token={`${token}.${key}`}
12+
key={`${token}.${key}`}
13+
/>
14+
)}
915
</Swatches>
1016
);
1117

src/components/Spacing.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function Spacing({ theme }) {
99
<Stack gap={4}>
1010
<Swatches items={theme.space}>
1111
{(token, value) => (
12-
<Swatch token={token} value={value}>
12+
<Swatch token={token} value={value} key={token}>
1313
<Stack gap={3} gridTemplateColumns="auto 1fr">
1414
<SwatchToken css={css({ p: 1 })}>{token}</SwatchToken>
1515
<SpacingSwatch value={value} />

src/components/Swatches.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Swatch, SwatchToken, SpacingSwatch } from "../";
66
<Stack gap={2}>
77
<Swatches theme={theme} items={theme.space}>
88
{(token, value) => (
9-
<Swatch token={token} value={value}>
9+
<Swatch token={token} value={value} key={token}>
1010
<SwatchToken>{token}</SwatchToken>
1111
<SpacingSwatch value={value} />
1212
</Swatch>

src/components/Typography.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function Typography({ theme }) {
1515
<Stack gap={5}>
1616
<Swatches theme={theme} items={theme.fontSizes}>
1717
{(token, value) => (
18-
<Swatch token={token} value={value}>
18+
<Swatch token={token} value={value} key={token}>
1919
<Stack gap={2}>
2020
<div>
2121
<SwatchToken css={{ display: "inline-block" }}>

0 commit comments

Comments
 (0)