generated from gravity-ui/package-example
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
10,516 additions
and
8,237 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 |
---|---|---|
@@ -1,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx commitlint -e |
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,4 +1 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx nano-staged |
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,15 +1,15 @@ | ||
import React from 'react'; | ||
|
||
import type {DecoratorFn} from '@storybook/react'; | ||
import {configure as uiKitConfigure} from '@gravity-ui/uikit'; | ||
import type {Decorator} from '@storybook/react'; | ||
|
||
import {Lang, configure} from '../../src'; | ||
import {configure} from '../../src'; | ||
|
||
export const withLang: DecoratorFn = (Story, context) => { | ||
export const withLang: Decorator = (Story, context) => { | ||
const lang = context.globals.lang; | ||
|
||
configure({ | ||
lang: lang as Lang, | ||
}); | ||
uiKitConfigure({lang}); | ||
configure({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 |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import React from 'react'; | ||
|
||
import {useMobile} from '@gravity-ui/uikit'; | ||
import type {DecoratorFn} from '@storybook/react'; | ||
import {MobileProvider} from '@gravity-ui/uikit'; | ||
import type {Decorator} from '@storybook/react'; | ||
|
||
export const withMobile: DecoratorFn = (Story, context) => { | ||
const mobileValue = context.globals.platform === 'mobile'; | ||
export const withMobile: Decorator = (Story, context) => { | ||
const platform = context.globals.platform; | ||
|
||
const [, setMobile] = useMobile(); // eslint-disable-line react-hooks/rules-of-hooks | ||
|
||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
React.useEffect(() => { | ||
setMobile(mobileValue); | ||
}, [mobileValue]); | ||
|
||
return <Story {...context} />; | ||
return ( | ||
<MobileProvider mobile={platform === 'mobile'} platform={platform}> | ||
<Story key={platform} {...context} /> | ||
</MobileProvider> | ||
); | ||
}; |
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'; | ||
|
||
export const withStrictMode: Decorator = (Story, context) => { | ||
const children = <Story {...context} />; | ||
|
||
if (context.parameters?.disableStrictMode) { | ||
return children; | ||
} | ||
|
||
return <React.StrictMode>{children}</React.StrictMode>; | ||
}; |
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,12 @@ | ||
import React from 'react'; | ||
|
||
import {ThemeProvider} from '@gravity-ui/uikit'; | ||
import type {Decorator} from '@storybook/react'; | ||
|
||
export const withTheme: Decorator = (Story, context) => { | ||
return ( | ||
<ThemeProvider theme={context.globals.theme} direction={context.globals.direction}> | ||
<Story {...context} /> | ||
</ThemeProvider> | ||
); | ||
}; |
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
Oops, something went wrong.