-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat!: migration on uikit 5 * fix: github workflow node.js version * fix(AsideHeader): background color * chore: update logo for storybook
- Loading branch information
1 parent
6eedc4b
commit a032d42
Showing
62 changed files
with
24,499 additions
and
23,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"sourceType": "unambiguous", | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"chrome": 100 | ||
} | ||
} | ||
], | ||
"@babel/preset-typescript", | ||
"@babel/preset-react" | ||
], | ||
"plugins": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14 | ||
18 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import type {Decorator} from '@storybook/react'; | ||
import {Lang, configure} from '../../src'; | ||
|
||
export const withLang: Decorator = (Story, context) => { | ||
const lang = context.globals.lang; | ||
|
||
configure({ | ||
lang: lang as Lang, | ||
}); | ||
|
||
return <Story key={lang} {...context} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import type {Decorator} from '@storybook/react'; | ||
import {useMobile} from '@gravity-ui/uikit'; | ||
|
||
export const withMobile: Decorator = (Story, context) => { | ||
const mobileValue = context.globals.platform === 'mobile'; | ||
|
||
const [, setMobile] = useMobile(); // eslint-disable-line react-hooks/rules-of-hooks | ||
|
||
React.useEffect(() => { | ||
setMobile(mobileValue); | ||
}, [mobileValue]); | ||
|
||
return <Story {...context} />; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
module.exports = { | ||
import type {StorybookConfig} from '@storybook/react-webpack5'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
{name: '@storybook/addon-essentials', options: {backgrounds: false}}, | ||
'@storybook/addon-interactions', | ||
'@storybook/preset-scss', | ||
'storybook-preset-inline-svg', | ||
'./theme-addon/register.tsx' | ||
], | ||
framework: '@storybook/react', | ||
features: { | ||
postcss: false, | ||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: {} | ||
}, | ||
docs: { | ||
autodocs: false, | ||
}, | ||
core: { | ||
disableTelemetry: true, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {addons} from '@storybook/addons'; | ||
import {themes} from './theme'; | ||
|
||
addons.setConfig({ | ||
theme: themes.light, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import './styles.scss'; | ||
import '@gravity-ui/uikit/styles/styles.css'; | ||
|
||
import React from 'react'; | ||
import type {Decorator, Preview} from '@storybook/react'; | ||
import {ThemeProvider, MobileProvider, Lang, configure as uiKitConfigure} from '@gravity-ui/uikit'; | ||
import {configure as componentsConfigure} from '@gravity-ui/components'; | ||
import {configure} from '../src'; | ||
import {withMobile} from './decorators/withMobile'; | ||
import {withLang} from './decorators/withLang'; | ||
|
||
configure({ | ||
lang: Lang.En, | ||
}); | ||
uiKitConfigure({ | ||
lang: Lang.En, | ||
}); | ||
componentsConfigure({ | ||
lang: Lang.En, | ||
}); | ||
|
||
const withContextProvider: Decorator = (Story, context) => { | ||
return ( | ||
<React.StrictMode> | ||
<ThemeProvider theme={context.globals.theme}> | ||
<MobileProvider> | ||
<Story {...context} /> | ||
</MobileProvider> | ||
</ThemeProvider> | ||
</React.StrictMode> | ||
); | ||
}; | ||
|
||
const preview: Preview = { | ||
decorators: [withMobile, withLang, withContextProvider], | ||
parameters: { | ||
jsx: {showFunctions: true}, | ||
options: { | ||
storySort: { | ||
order: ['Theme', 'Components', ['Basic']], | ||
method: 'alphabetical', | ||
}, | ||
}, | ||
layout: 'fullscreen', | ||
}, | ||
globalTypes: { | ||
theme: { | ||
name: 'Theme', | ||
defaultValue: 'light', | ||
toolbar: { | ||
icon: 'mirror', | ||
items: [ | ||
{value: 'light', right: '☼', title: 'Light'}, | ||
{value: 'dark', right: '☾', title: 'Dark'}, | ||
{value: 'light-hc', right: '☼', title: 'High Contrast Light (beta)'}, | ||
{value: 'dark-hc', right: '☾', title: 'High Contrast Dark (beta)'}, | ||
], | ||
}, | ||
}, | ||
lang: { | ||
name: 'Language', | ||
defaultValue: 'en', | ||
toolbar: { | ||
icon: 'globe', | ||
items: [ | ||
{value: 'en', right: '🇬🇧', title: 'En'}, | ||
{value: 'ru', right: '🇷🇺', title: 'Ru'}, | ||
], | ||
}, | ||
}, | ||
platform: { | ||
name: 'Platform', | ||
defaultValue: 'desktop', | ||
toolbar: { | ||
items: [ | ||
{value: 'desktop', title: 'Desktop', icon: 'browser'}, | ||
{value: 'mobile', title: 'Mobile', icon: 'mobile'}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '~@doc-tools/transform/dist/css/yfm.css'; | ||
|
||
body { | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react'; | ||
import {addons, types} from '@storybook/addons'; | ||
import {useGlobals, type API} from '@storybook/api'; | ||
import {getThemeType} from '@gravity-ui/uikit'; | ||
import {themes} from '../theme'; | ||
|
||
const ADDON_ID = 'yc-theme-addon'; | ||
const TOOL_ID = `${ADDON_ID}tool`; | ||
|
||
addons.register(ADDON_ID, (api) => { | ||
addons.add(TOOL_ID, { | ||
type: types.TOOL, | ||
title: 'Theme', | ||
render: () => { | ||
return <Tool api={api} />; | ||
}, | ||
}); | ||
}); | ||
|
||
function Tool({api}: {api: API}) { | ||
const [{theme}] = useGlobals(); | ||
React.useEffect(() => { | ||
api.setOptions({theme: themes[getThemeType(theme)]}); | ||
}, [theme]); | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {create} from '@storybook/theming'; | ||
|
||
export const CloudThemeLight = create({ | ||
base: 'light', | ||
|
||
colorPrimary: '#027bf3', | ||
colorSecondary: 'rgba(2, 123, 243, 0.6)', | ||
|
||
// Typography | ||
fontBase: '"Helvetica Neue", Arial, Helvetica, sans-serif', | ||
fontCode: | ||
'"SF Mono", "Menlo", "Monaco", "Consolas", "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", "Courier", monospace', | ||
|
||
// Text colors | ||
textColor: 'black', | ||
textInverseColor: 'black', | ||
|
||
// Toolbar default and active colors | ||
barTextColor: 'silver', | ||
barSelectedColor: '#027bf3', | ||
// barBg: '#027bf3', | ||
|
||
// Form colors | ||
inputBg: 'white', | ||
inputBorder: 'silver', | ||
inputTextColor: 'black', | ||
inputBorderRadius: 4, | ||
|
||
brandUrl: 'https://github.com/gravity-ui/uikit', | ||
brandTitle: `<div style="font-size: 18px; color: #027bf3; font-weight: 600; margin-top: -6px; margin-bottom: 2px;">Gravity UI</div> | ||
<div style="font-size: 14px;color: #7d7d7d;font-weight: 400;">Components</div>`, | ||
}); | ||
|
||
export const CloudThemeDark = create({ | ||
base: 'dark', | ||
}); | ||
|
||
export const themes = { | ||
light: CloudThemeLight, | ||
dark: CloudThemeDark, | ||
}; |
Oops, something went wrong.