Skip to content

Commit

Permalink
chore(storybook): add custom theme showcase
Browse files Browse the repository at this point in the history
  • Loading branch information
DaryaLari committed Jan 15, 2025
1 parent 44dd13a commit 4e976e0
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .storybook/src/ShowcaseCustom.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';

import {Flex, Icon, spacing} from '@gravity-ui/uikit';
import {Meta, StoryFn} from '@storybook/react';

import {ImportsTooltip} from './ImportsTooltip/ImportsTooltip';
import {IllustrationMeta} from './types';

import metadata from '../../metadata.json';

import './customTheme.scss';

const meta = {
title: 'Components',
id: 'components',
args: {
size: 300,
},
} as Meta;

export default meta;

const items = (metadata.illustrations as IllustrationMeta[]).map((meta) => {

Check warning on line 23 in .storybook/src/ShowcaseCustom.stories.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'meta' is already declared in the upper scope on line 13 column 7
const Component = require(`../../src/components/${meta.componentName}.tsx`).default;

return {
meta,
Component,
};
});

export const CustomThemeComponents: StoryFn = ({size}) => {
return (
<div className={`custom ${spacing({p: 4})}`}>
<Flex gap={8} wrap>
{items.map(({meta, Component}) => {

Check warning on line 36 in .storybook/src/ShowcaseCustom.stories.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'meta' is already declared in the upper scope on line 13 column 7
return (
<ImportsTooltip key={meta.svgName} meta={meta}>
<Icon data={Component} size={size} />
</ImportsTooltip>
);
})}
</Flex>
</div>
);
};
25 changes: 25 additions & 0 deletions .storybook/src/customTheme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.g-root {
&_theme_light .custom,
&_theme_light-hc .custom {
--gil-color-object-base: rgb(103, 55, 12);
--gil-color-object-accent-heavy: rgb(89, 50, 16);
--gil-color-object-hightlight: rgb(164, 135, 109);
--gil-color-shadow-over-object: rgb(89, 50, 16);
--gil-color-background-lines: rgb(133, 95, 61);
--gil-color-background-shapes: rgb(242, 242, 242);
--gil-color-object-accent-light: rgb(255, 255, 255);
--gil-color-object-danger: rgb(255, 4, 1);
}

&_theme_dark .custom,
&_theme_dark-hc .custom {
--gil-color-object-base: rgb(103, 55, 12);
--gil-color-object-accent-heavy: rgb(89, 50, 16);
--gil-color-object-hightlight: rgb(82, 47, 19);
--gil-color-shadow-over-object: rgb(118, 75, 36);
--gil-color-background-lines: rgb(103, 55, 12);
--gil-color-background-shapes: rgb(78, 74, 78);
--gil-color-object-accent-light: rgb(255, 255, 255);
--gil-color-object-danger: rgb(255, 4, 1);
}
}

0 comments on commit 4e976e0

Please sign in to comment.