Add CssBaseline decorator and Roboto to Storybook
This commit is contained in:
parent
b519c9f3b5
commit
1fa6d70cb0
3 changed files with 23 additions and 1 deletions
|
@ -1,6 +1,11 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
import intlDecorate from '../../app/javascript/components/tests/intl';
|
||||
import cssBaseline from '../../app/javascript/components/tests/decorators/baseline'
|
||||
import '../../app/javascript/components/tests/decorators/roboto'
|
||||
|
||||
const jest = require('jest-mock');
|
||||
window.jest = jest;
|
||||
|
||||
export const decorators = [intlDecorate()]
|
||||
|
||||
|
||||
export const decorators = [intlDecorate(), cssBaseline()]
|
||||
|
|
16
app/javascript/components/tests/decorators/baseline.tsx
Normal file
16
app/javascript/components/tests/decorators/baseline.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import React from 'react';
|
||||
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||
import type {DecoratorFn} from '@storybook/react';
|
||||
import { StoryFn } from '@storybook/addons';
|
||||
|
||||
|
||||
function decorator(story:StoryFn<JSX.Element>): JSX.Element {
|
||||
return (<>
|
||||
<CssBaseline/>
|
||||
{story()}
|
||||
</>);
|
||||
}
|
||||
|
||||
export default function decorate(): DecoratorFn {
|
||||
return decorator;
|
||||
}
|
1
app/javascript/components/tests/decorators/roboto.ts
Normal file
1
app/javascript/components/tests/decorators/roboto.ts
Normal file
|
@ -0,0 +1 @@
|
|||
import 'fontsource-roboto';
|
Loading…
Reference in a new issue