+
{}
{colors.map((color) => (
{tints.map((tint) => (
@@ -41,7 +71,7 @@ export const BackgroundColors: Story = {
style={{ width: "72px", height: "48px" }}
className={"bg-" + color + "-" + tint}
/>
-
+
bg-{color}-{tint}
@@ -53,6 +83,111 @@ export const BackgroundColors: Story = {
},
};
+export const ContextualBackgrounds: Story = {
+ render: () => {
+ const { background } = tokens.themes.default.contextuals;
+
+ // Extract all background values from the contextuals
+ const backgroundEntries = Object.entries(background).flatMap(
+ ([category, values]) => {
+ if (typeof values === "object" && values !== null) {
+ return Object.entries(values).map(([key, value]) => ({
+ category,
+ key,
+ value,
+ fullKey: `${category}-${key}`,
+ }));
+ }
+ return [];
+ }
+ );
+
+ // Group by category
+ const groupedBackgrounds = backgroundEntries.reduce(
+ (acc, entry) => {
+ if (!acc[entry.category]) {
+ acc[entry.category] = [];
+ }
+ acc[entry.category].push(entry);
+ return acc;
+ },
+ {} as Record
+ );
+
+ return (
+
+ {Object.entries(groupedBackgrounds).map(([category, entries]) => (
+
+
+ {category}
+
+
+ {entries.map(({ key, value, fullKey }) => (
+
+
+
{key}
+
+ {value}
+
+
+ .bg-{fullKey}
+
+
+ ))}
+
+
+ ))}
+
+ );
+ },
+};
+
export const TextColors: Story = {
render: () => {
return (
@@ -90,13 +225,13 @@ export const Example: Story = {
render: () => {
return (
<>
-
+
I am a text on top of a primary-500 background 👋
-
+
I am a text on top of a secondary-500 background 👋
-
+
I am a text on top of a danger-500 background 👋
>
diff --git a/packages/react/src/docs/spacings.stories.tsx b/packages/react/src/docs/spacings.stories.tsx
index a33923c..07988e8 100644
--- a/packages/react/src/docs/spacings.stories.tsx
+++ b/packages/react/src/docs/spacings.stories.tsx
@@ -33,12 +33,12 @@ export const Default: Story = {
{value}
);
- },
+ }
)}
);
@@ -48,11 +48,11 @@ export const Default: Story = {
export const Example: Story = {
render: () => {
return (
-
-
+
+
Tiny padding + Large margin bottom
-
+
Large padding + Base margin left