-
Notifications
You must be signed in to change notification settings - Fork 6
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
1 parent
f191be4
commit d63c758
Showing
10 changed files
with
242 additions
and
3 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
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,7 @@ | ||
.dcx-pre { | ||
color: token('color-text-pre_body'); | ||
background-color: token('color-background-pre_box'); | ||
font-size: token('font-size-pre_body'); | ||
font-family: token('font-family-pre_body'); | ||
font-weight: token('font-weight-pre_body'); | ||
} |
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
53 changes: 53 additions & 0 deletions
53
stories/PreformattedText/design-system/AccessibleTheme.stories.js
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,53 @@ | ||
import { PreformattedText } from '../../../src/preformattedText/PreformattedText'; | ||
import style from '!raw-loader!../../themes/accessible.theme.css'; | ||
import { LiveProvider, LiveEditor } from 'react-live'; | ||
import { StorybookUtils } from '../../../core/storybook/StorybookUtils'; | ||
|
||
/** | ||
* This a theme aimed at easing the vizualization of the different elements of the component in order to improve the experience for people that have visual impairments. | ||
*/ | ||
export default { | ||
title: 'DCXLibrary/Typography/PreformattedText/Design system/Accessible', | ||
component: PreformattedText, | ||
decorators: [ | ||
getStory => { | ||
require('../../../dist/design-system/index.css'); | ||
require('../../themes/accessible.theme.css'); | ||
return getStory(); | ||
}, | ||
], | ||
parameters: { | ||
options: { showPanel: true }, | ||
actions: { disable: true }, | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export const ShowCase = { | ||
parameters: { | ||
backgrounds: { | ||
default: 'dark', | ||
values: [ | ||
{ name: 'dark', value: '#282c34' }, | ||
{ name: 'light', value: '#fff' }, | ||
], | ||
}, | ||
}, | ||
render: () => ( | ||
<LiveProvider | ||
code={StorybookUtils.getThemeCode('dcx-pre', style)} | ||
disabled={true} | ||
language="css" | ||
> | ||
<LiveEditor className="liveEditor" aria-label="editor" /> | ||
</LiveProvider> | ||
), | ||
}; | ||
|
||
export const Default = { | ||
name: 'Default', | ||
args: { | ||
value: `Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and | ||
line breaks.`, | ||
}, | ||
}; |
63 changes: 63 additions & 0 deletions
63
stories/PreformattedText/design-system/DarkTheme.stories.js
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,63 @@ | ||
import { PreformattedText } from '../../../src/preformattedText/PreformattedText'; | ||
// eslint-disable-next-line import/no-webpack-loader-syntax | ||
import style from '!raw-loader!../../themes/dark.theme.css'; | ||
import { LiveProvider, LiveEditor } from 'react-live'; | ||
import { StorybookUtils } from '../../../core/storybook/StorybookUtils'; | ||
|
||
/** | ||
* This a theme showcases how to customize the component so it can be used on dark backgrounds. | ||
*/ | ||
export default { | ||
title: 'DCXLibrary/Typography/PreformattedText/Design system/Dark', | ||
component: PreformattedText, | ||
decorators: [ | ||
getStory => { | ||
require('../../../dist/design-system/index.css'); | ||
require('../../themes/dark.theme.css'); | ||
return getStory(); | ||
}, | ||
], | ||
parameters: { | ||
options: { showPanel: true }, | ||
actions: { disable: true }, | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export const ShowCase = { | ||
parameters: { | ||
backgrounds: { | ||
default: 'dark', | ||
values: [ | ||
{ name: 'dark', value: '#282c34' }, | ||
{ name: 'light', value: '#fff' }, | ||
], | ||
}, | ||
}, | ||
render: () => ( | ||
<LiveProvider | ||
code={StorybookUtils.getThemeCode('dcx-pre', style)} | ||
disabled={true} | ||
language="css" | ||
> | ||
<LiveEditor className="liveEditor" aria-label="editor" /> | ||
</LiveProvider> | ||
), | ||
}; | ||
|
||
export const Default = { | ||
name: 'Default', | ||
parameters: { | ||
backgrounds: { | ||
default: 'dark', | ||
values: [ | ||
{ name: 'dark', value: '#282c34' }, | ||
{ name: 'light', value: '#fff' }, | ||
], | ||
}, | ||
}, | ||
args: { | ||
value: `Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and | ||
line breaks.`, | ||
}, | ||
}; |
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,27 @@ | ||
import { PreformattedText } from '../../../src/preformattedText/PreformattedText'; | ||
/** | ||
* Here we display the component in its natural preformattedText, importing only the base Design System styles. | ||
*/ | ||
export default { | ||
title: 'DCXLibrary/Typography/PreformattedText/Design system/Default', | ||
component: PreformattedText, | ||
decorators: [ | ||
getStory => { | ||
require('../../../dist/design-system/index.css'); | ||
return getStory(); | ||
}, | ||
], | ||
parameters: { | ||
options: { showPanel: true }, | ||
actions: { disable: true }, | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export const Default = { | ||
name: 'Default', | ||
args: { | ||
value: `Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and | ||
line breaks.`, | ||
}, | ||
}; |
55 changes: 55 additions & 0 deletions
55
stories/PreformattedText/design-system/MaterialTheme.stories.js
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,55 @@ | ||
import { PreformattedText } from '../../../src/preformattedText/PreformattedText'; | ||
import { LiveProvider, LiveEditor } from 'react-live'; | ||
// eslint-disable-next-line import/no-webpack-loader-syntax | ||
import style from '!raw-loader!../../themes/material.theme.css'; | ||
import { StorybookUtils } from '../../../core/storybook/StorybookUtils'; | ||
|
||
/** | ||
* This a theme showcases an appearance similar to Material UI can be achieved. | ||
* If you copy paste this snippet inside your css file you'll get a material design style | ||
*/ | ||
export default { | ||
title: 'DCXLibrary/Typography/PreformattedText/Design system/Material', | ||
component: PreformattedText, | ||
decorators: [ | ||
getStory => { | ||
require('../../../dist/design-system/index.css'); | ||
require('../../themes/material.theme.css'); | ||
return getStory(); | ||
}, | ||
], | ||
parameters: { | ||
options: { showPanel: true }, | ||
actions: { disable: true }, | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export const ShowCase = { | ||
parameters: { | ||
backgrounds: { | ||
default: 'dark', | ||
values: [ | ||
{ name: 'dark', value: '#282c34' }, | ||
{ name: 'light', value: '#fff' }, | ||
], | ||
}, | ||
}, | ||
render: () => ( | ||
<LiveProvider | ||
code={StorybookUtils.getThemeCode('dcx-pre', style)} | ||
disabled={true} | ||
language="css" | ||
> | ||
<LiveEditor className="liveEditor" aria-label="editor" /> | ||
</LiveProvider> | ||
), | ||
}; | ||
|
||
export const Default = { | ||
name: 'Default', | ||
args: { | ||
value: `Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and | ||
line breaks.`, | ||
}, | ||
}; |
24 changes: 24 additions & 0 deletions
24
stories/PreformattedText/design-system/Playground.stories.js
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,24 @@ | ||
/* eslint-disable import/no-webpack-loader-syntax */ | ||
import style from '!raw-loader!../../../dist/design-system/preformattedText.css'; | ||
import TokensDecorator from '../../../core/storybook/TokensDecorator'; | ||
import { PreformattedText } from '../../../src/preformattedText/PreformattedText'; | ||
|
||
export default { | ||
title: 'DCXLibrary/Typography/PreformattedText/Design system', | ||
component: PreformattedText, | ||
decorators: [ | ||
getStory => <TokensDecorator style={style}>{getStory()}</TokensDecorator>, | ||
], | ||
parameters: { | ||
options: { showPanel: true }, | ||
actions: { disable: true }, | ||
}, | ||
}; | ||
|
||
export const Playground = { | ||
name: 'Playground', | ||
args: { | ||
value: `Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and | ||
line breaks.`, | ||
}, | ||
}; |
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