- {['text', ...tints].map(tint => {
+ {tints.map(tint => {
const classes = ['fs-s', 'mt-st', 'clr-' + color + '-' + tint];
if (tint === 'text') {
classes.push('bg-' + color + '-500');
@@ -82,7 +82,7 @@ render readable text on top of a -500 background of its own color variation. Ple
@@ -97,12 +97,16 @@ You can customize the values of the color design tokens with the configuration f
code={`
// cunningham.ts|cjs
export default {
- theme: {
- colors: {
- 'primary-500': 'purple', // You can customize the existing primary-500 color. ( bg-primary-500, clr-primary-500 classes ),
- 'primary-text': 'cream',
- 'amazing-500': 'pink', // You can add a new color. ( bg-amazing-500, clr-amazing-500 classes will be generated )
- }
+ themes: {
+ default: {
+ theme: {
+ colors: {
+ 'primary-500': 'purple', // You can customize the existing primary-500 color. ( bg-primary-500, clr-primary-500 classes ),
+ 'primary-text': 'cream',
+ 'amazing-500': 'pink', // You can add a new color. ( bg-amazing-500, clr-amazing-500 classes will be generated )
+ },
+ },
+ },
}
`}
-/>
\ No newline at end of file
+/>
diff --git a/packages/react/src/docs/customization.mdx b/packages/react/src/docs/customization.mdx
index 87cd8f0..a434cea 100644
--- a/packages/react/src/docs/customization.mdx
+++ b/packages/react/src/docs/customization.mdx
@@ -34,11 +34,15 @@ If you prefer using Typescript, create a file named `cunningham.ts` at the root
import { DefaultTokens } from "@openfun/cunningham-react";
const config: DefaultTokens = {
- theme: {
- colors: {
- "primary-500": "purple",
+ themes: {
+ default: {
+ theme: {
+ colors: {
+ "primary-500": "purple",
+ },
},
},
+ },
};
export default config;
@@ -52,9 +56,13 @@ Or if you prefer Javascript, create a file named `cunningham.cjs` at the root of
@@ -93,12 +101,16 @@ For our example we focus on the `border-radius` design token. Now, incorporate t
import { DefaultTokens } from "@openfun/cunningham-react";
const config: DefaultTokens = {
- theme: {
- ...
- },
- components: {
- button: {
- "border-radius": "30px",
+ themes: {
+ default: {
+ theme: {
+ ...
+ },
+ components: {
+ button: {
+ "border-radius": "30px",
+ },
+ },
},
},
};
@@ -129,12 +141,16 @@ let's say we want keep the same border radius when the `Button` component is act
import { defaultTokens, DefaultTokens } from "@openfun/cunningham-react";
const config: DefaultTokens = {
- theme: {
- ...
- },
- components: {
- button: {
- "border-radius--active": defaultTokens.components.button["border-radius"],
+ themes: {
+ default: {
+ theme: {
+ ...
+ },
+ components: {
+ button: {
+ "border-radius--active": defaultTokens.components.button["border-radius"],
+ },
+ },
},
},
};
@@ -152,12 +168,16 @@ You can also use more global design tokens from `defaultTokens.theme`, like that
import { defaultTokens, DefaultTokens } from "@openfun/cunningham-react";
const config: DefaultTokens = {
- theme: {
- ...
- },
- components: {
- button: {
- "medium-font-size": defaultTokens.theme.font.sizes.s,
+ themes: {
+ default: {
+ theme: {
+ ...
+ },
+ components: {
+ button: {
+ "medium-font-size": defaultTokens.theme.font.sizes.s,
+ },
+ },
},
},
};
diff --git a/packages/react/src/docs/spacings.mdx b/packages/react/src/docs/spacings.mdx
index 178bba9..4b22c80 100644
--- a/packages/react/src/docs/spacings.mdx
+++ b/packages/react/src/docs/spacings.mdx
@@ -11,10 +11,10 @@ Here are the existing spacings: