2023-04-18 22:22:03 +02:00
|
|
|
import './styles/global.css';
|
2023-05-13 17:23:29 +02:00
|
|
|
|
2024-02-17 19:57:39 +00:00
|
|
|
import React from 'react';
|
2024-02-21 11:57:59 +00:00
|
|
|
import { UnistylesRegistry } from 'react-native-unistyles';
|
2024-05-27 21:44:18 +00:00
|
|
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
2023-04-18 22:22:03 +02:00
|
|
|
|
2024-02-17 19:57:39 +00:00
|
|
|
import {
|
|
|
|
Title,
|
|
|
|
Subtitle,
|
|
|
|
Description,
|
|
|
|
Primary,
|
|
|
|
Controls,
|
|
|
|
Stories,
|
|
|
|
} from '@storybook/blocks';
|
2023-04-18 22:22:03 +02:00
|
|
|
|
2024-02-21 09:01:56 +00:00
|
|
|
import { TolgeeProvider, useTolgee, TolgeeChain } from '@procyon/localization/tolgee';
|
2024-02-21 11:57:59 +00:00
|
|
|
import { procyonLightTheme } from '@procyon/styles/theme/light';
|
|
|
|
import { mergeDeepRight } from 'ramda';
|
2024-03-24 12:03:22 +00:00
|
|
|
import { procyonBreakpoints } from '@procyon/styles/theme/breakpoints';
|
2024-02-21 11:57:59 +00:00
|
|
|
|
|
|
|
// Init Unistyles
|
2024-03-26 14:21:55 +00:00
|
|
|
export const themes = { light: mergeDeepRight(procyonLightTheme, {}) };
|
2024-03-24 12:03:22 +00:00
|
|
|
export const breakpoints = mergeDeepRight(procyonBreakpoints, {});
|
|
|
|
|
2024-05-28 17:50:20 +00:00
|
|
|
UnistylesRegistry.addThemes(themes).addBreakpoints(breakpoints).addConfig({
|
|
|
|
adaptiveThemes: true,
|
|
|
|
initialTheme: 'light',
|
|
|
|
});
|
2024-02-21 11:57:59 +00:00
|
|
|
|
|
|
|
// Init Tolgee
|
2024-06-01 15:06:04 +00:00
|
|
|
export const tolgee = TolgeeChain.init({
|
2024-02-21 11:57:59 +00:00
|
|
|
apiKey: process.env.TOLGEE_API_KEY,
|
|
|
|
apiUrl: process.env.TOLGEE_API_URL,
|
|
|
|
language: 'en',
|
2024-06-01 15:06:04 +00:00
|
|
|
ns: ['procyon', 'button', 'calendar'],
|
2024-02-21 11:57:59 +00:00
|
|
|
});
|
2023-05-13 17:23:29 +02:00
|
|
|
|
|
|
|
export const globalTypes = {
|
|
|
|
locale: {
|
|
|
|
name: 'Locale',
|
|
|
|
defaultValue: 'en',
|
|
|
|
toolbar: {
|
|
|
|
icon: 'globe',
|
|
|
|
showName: true,
|
|
|
|
items: [
|
|
|
|
{ value: 'en', right: '🇺🇸', title: 'English' },
|
|
|
|
{ value: 'cs', right: '🇨🇿', title: 'Čeština' },
|
|
|
|
],
|
2023-04-18 22:22:03 +02:00
|
|
|
},
|
2023-05-13 17:23:29 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2024-02-17 19:57:39 +00:00
|
|
|
export const decorators = [
|
2024-02-21 09:01:56 +00:00
|
|
|
(Story, context) => {
|
|
|
|
const { locale } = context.globals;
|
|
|
|
const tolgee = useTolgee();
|
|
|
|
tolgee.changeLanguage(locale);
|
|
|
|
return <Story />;
|
|
|
|
},
|
2024-02-17 19:57:39 +00:00
|
|
|
(Story) => {
|
|
|
|
return (
|
2024-02-21 09:01:56 +00:00
|
|
|
<TolgeeProvider tolgee={tolgee}>
|
2024-02-17 19:57:39 +00:00
|
|
|
<Story />
|
|
|
|
</TolgeeProvider>
|
|
|
|
);
|
|
|
|
},
|
2024-05-27 21:44:18 +00:00
|
|
|
(Story) => {
|
|
|
|
return (
|
|
|
|
<GestureHandlerRootView>
|
|
|
|
<Story />
|
|
|
|
</GestureHandlerRootView>
|
|
|
|
);
|
|
|
|
},
|
2024-02-17 19:57:39 +00:00
|
|
|
];
|
2023-05-13 17:23:29 +02:00
|
|
|
|
|
|
|
export const parameters = {
|
|
|
|
options: {
|
|
|
|
storySort: {
|
2024-02-20 15:22:13 +00:00
|
|
|
method: 'alphabetical-by-kind',
|
2023-05-13 17:23:29 +02:00
|
|
|
order: [
|
|
|
|
'Introduction',
|
|
|
|
'Auth',
|
2023-09-28 19:53:10 +02:00
|
|
|
'Api',
|
2023-05-13 17:23:29 +02:00
|
|
|
['Introduction'],
|
|
|
|
'components',
|
2024-02-20 15:22:13 +00:00
|
|
|
['Inputs', 'Layout', 'Display', 'Utils', '*'],
|
2023-05-13 17:23:29 +02:00
|
|
|
'Form',
|
|
|
|
['Introduction', 'Implementation'],
|
|
|
|
'Localization',
|
|
|
|
['Introduction', 'Example'],
|
2024-02-21 11:57:59 +00:00
|
|
|
'Styles',
|
|
|
|
['Introduction', '*'],
|
2023-05-13 17:23:29 +02:00
|
|
|
],
|
2023-04-18 22:22:03 +02:00
|
|
|
},
|
|
|
|
},
|
2023-05-13 17:23:29 +02:00
|
|
|
docs: {
|
|
|
|
page: () => (
|
|
|
|
<>
|
|
|
|
<Title />
|
|
|
|
<Subtitle />
|
|
|
|
<Description />
|
|
|
|
<Primary />
|
|
|
|
<Controls />
|
|
|
|
<Stories />
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
},
|
2023-04-18 22:22:03 +02:00
|
|
|
};
|