Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9.x #144

Merged
18 commits merged into from
Feb 12, 2024
Merged

0.9.x #144

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .storybook/ColorScheme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { MantineColorScheme } from '@mantine/core';
import type { StoryContext } from '@storybook/react';

import { useMantineColorScheme } from '@mantine/core';
import { useEffect } from 'react';

interface IColorSchemeProps {
context: StoryContext;
}

export default function ColorScheme(props: IColorSchemeProps): null {
const {
context: {
globals: { colorScheme },
},
} = props;
const { setColorScheme } = useMantineColorScheme();

useEffect(() => {
setColorScheme(colorScheme as MantineColorScheme);
}, [colorScheme, setColorScheme]);

return null;
}
27 changes: 27 additions & 0 deletions .storybook/WithProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { StoryContext, StoryFn } from '@storybook/react';
import type { ReactElement } from 'react';

import { MantineProvider } from '@mantine/core';

import { Provider, themes } from '@smile/react-front-kit-shared';

import ColorScheme from './ColorScheme';

export default function WithProvider(
Story: StoryFn,
context: StoryContext,
): ReactElement {
const {
globals: { theme },
} = context;
return (
<Provider>
<MantineProvider
theme={themes[theme as 'main' | 'primary' | 'secondary'].theme}
>
<ColorScheme context={context} />
<Story />
</MantineProvider>
</Provider>
);
}
4 changes: 4 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/lipis/[email protected]/css/flag-icons.min.css"
/>
33 changes: 13 additions & 20 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import type { Preview, StoryContext, StoryFn } from '@storybook/react';
import type { ReactElement } from 'react';
/* eslint-disable import/order */

import { MantineProvider } from '@mantine/core';
import type { Preview } from '@storybook/react';

import { Provider, themes } from '@smile/react-front-kit-shared';
import '@mantine/core/styles.css';
import '@mantine/dates/styles.css';
import '@mantine/dropzone/styles.css';
import '@mantine/carousel/styles.css';
import { themes } from '@smile/react-front-kit-shared';
import '@smile/react-front-kit-shared/style.css';
import '@smile/react-front-kit/style.css';
import '@smile/react-front-kit-dropzone/style.css';
import '@smile/react-front-kit-table/style.css';

function withProvider(Story: StoryFn, context: StoryContext): ReactElement {
return (
<Provider>
<MantineProvider
theme={{
...themes[context.globals.theme as 'main' | 'primary' | 'secondary']
.theme,
colorScheme: context.globals.colorScheme as 'dark' | 'light',
}}
>
<Story />
</MantineProvider>
</Provider>
);
}
import WithProvider from './WithProvider';

const style = {
border: '1px solid lightgrey',
Expand All @@ -28,7 +21,7 @@ const style = {
width: 14,
};
const preview: Preview = {
decorators: [withProvider],
decorators: [WithProvider],
globalTypes: {
colorScheme: {
defaultValue: 'light',
Expand Down
8 changes: 8 additions & 0 deletions apps/next/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import type { ReactElement, ReactNode } from 'react';

import '@mantine/core/styles.css';
import '@mantine/dates/styles.css';
import '@mantine/dropzone/styles.css';
import '@smile/react-front-kit/style.css';
import '@smile/react-front-kit-dropzone/style.css';
import { Provider } from '@smile/react-front-kit-shared';
import '@smile/react-front-kit-shared/style.css';
import '@smile/react-front-kit-table/style.css';
import { Open_Sans } from 'next/font/google';
import 'storybook-pages/style.css';

const openSans = Open_Sans({
display: 'swap',
Expand Down
2 changes: 1 addition & 1 deletion apps/next/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactElement } from 'react';

import { BrowsingPage } from 'storybook-pages/src';
import { BrowsingPage } from 'storybook-pages';

export default function Page(): ReactElement {
return <BrowsingPage />;
Expand Down
1 change: 0 additions & 1 deletion apps/next/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
reactStrictMode: true,
transpilePackages: ['@smile/react-front-kit'],
};
13 changes: 8 additions & 5 deletions apps/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
"lint": "next lint"
},
"dependencies": {
"@mantine/core": "^6.0.20",
"@mantine/hooks": "^6.0.20",
"@mantine/styles": "^6.0.20",
"@mantine/core": "^7.5.1",
"@mantine/dates": "^7.5.1",
"@mantine/dropzone": "^7.5.1",
"@mantine/hooks": "^7.5.1",
"@phosphor-icons/react": "^2.0.10",
"@smile/react-front-kit": "*",
"@smile/react-front-kit-dropzone": "*",
"@smile/react-front-kit-shared": "*",
"@smile/react-front-kit-table": "*",
"next": "^13.4.19",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@smile/react-front-kit": "*",
"@smile/react-front-kit-shared": "*",
"storybook-pages": "*"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ declare module '*.png' {
const value: string;
export default value;
}

declare module '*.module.css';
Loading
Loading