diff --git a/examples/stories/src/tutorial/design/tokens/colors.mdx b/examples/stories/src/tutorial/design/tokens/colors.mdx index 86871446c..e18fb9a73 100644 --- a/examples/stories/src/tutorial/design/tokens/colors.mdx +++ b/examples/stories/src/tutorial/design/tokens/colors.mdx @@ -44,6 +44,7 @@ import { SkylineColorPalette, SolidColorPalette, UniformColorPalette, + VanillaColorPalette, } from '@component-controls/design-tokens'; # Overview @@ -1761,4 +1762,45 @@ import { UniformColorPalette } from '@component-controls/design-tokens'; AlertLight: '#f3c6b7', Weather: '#990099', }} +/> + + +## VanillaColor + +The [VanillaColor](/api/design-tokens-colors-vanillacolor--overview) component displays the color as a color block with sass variable name and hex color value. + +Design inspired from [Vanilla](https://vanillaframework.io/docs/settings/color-settings). + +``` +import { VanillaColorPalette } from '@component-controls/design-tokens'; + + +``` + + \ No newline at end of file diff --git a/ui/design-tokens/src/Colors/VanillaColor/VanillaColor.stories.tsx b/ui/design-tokens/src/Colors/VanillaColor/VanillaColor.stories.tsx new file mode 100644 index 000000000..c53288cdb --- /dev/null +++ b/ui/design-tokens/src/Colors/VanillaColor/VanillaColor.stories.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import { ControlTypes } from '@component-controls/core'; +import { VanillaColor, VanillaColorPalette } from './VanillaColor'; +import { ColorProps } from '../../types'; + +export default { + title: 'Design Tokens/Colors/VanillaColor', + component: VanillaColor, +}; + +export const overview = ({ name, color }: ColorProps) => ( + +); + +overview.controls = { + name: 'negative', + color: { + type: ControlTypes.OBJECT, + value: { + value: { type: ControlTypes.COLOR, value: '#C7162B' }, + sass: '$color-negative', + }, + }, +}; + +export const palette = () => ( + +); diff --git a/ui/design-tokens/src/Colors/VanillaColor/VanillaColor.tsx b/ui/design-tokens/src/Colors/VanillaColor/VanillaColor.tsx new file mode 100644 index 000000000..8c07ab4be --- /dev/null +++ b/ui/design-tokens/src/Colors/VanillaColor/VanillaColor.tsx @@ -0,0 +1,69 @@ +/** @jsx jsx */ +import { FC } from 'react'; +import { jsx, Theme } from 'theme-ui'; +import { CopyContainer } from '@component-controls/components'; +import { ColorBlockProps, ColorValue } from '../../types'; +import { GridContainerProps, GridContainer } from '../../components'; + +/** + * Color item displaying the color as a color block with sass variable name and hex color value. + * Design inspired from [Vanilla](https://vanillaframework.io/docs/settings/color-settings). + */ +export const VanillaColor: FC = ({ name, color }) => { + const colorObj: ColorValue = + typeof color === 'string' ? { value: color } : color; + const { value: colorValue, sass } = colorObj; + return ( +
`1px solid ${t.colors?.shadow}`, + }} + > + `1px solid ${t.colors?.shadow}`, + bg: colorValue, + ':after': { + content: '""', + display: 'block', + paddingBottom: '30%', + }, + }} + /> +
+
{sass}
+
{colorValue}
+
+
+ ); +}; + +/** + * + * palette displayed with VanillaColor items + * using a css grid for the dsplay + */ +export const VanillaColorPalette: FC> = props => ( + + {({ name, value }) => ( + + )} + +); diff --git a/ui/design-tokens/src/Colors/VanillaColor/index.ts b/ui/design-tokens/src/Colors/VanillaColor/index.ts new file mode 100644 index 000000000..1ac744abf --- /dev/null +++ b/ui/design-tokens/src/Colors/VanillaColor/index.ts @@ -0,0 +1 @@ +export * from './VanillaColor'; diff --git a/ui/design-tokens/src/Colors/index.ts b/ui/design-tokens/src/Colors/index.ts index 98b24b410..a46165a10 100644 --- a/ui/design-tokens/src/Colors/index.ts +++ b/ui/design-tokens/src/Colors/index.ts @@ -31,3 +31,4 @@ export * from './SeekColor'; export * from './SkylineColor'; export * from './SolidColor'; export * from './UniformColor'; +export * from './VanillaColor';