-
Notifications
You must be signed in to change notification settings - Fork 6
Code snippet - design system #543
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
651db7d
style: code snippet design system added
acb334e
style: class name updated
43650c4
style: classname fixed
8674023
style:dark theme added
1dc8708
Merge branch 'release/1.0.0' into feature/ds-code-snippet
daniele-zurico b4e4115
chore:resolved conflict
33889cf
Merge branch 'release/1.0.0' into feature/ds-code-snippet
ybayraktutan 876f7d4
style:addressed the feedback
6b25ed1
chore:merged with release
00de6a1
chore: deleted unused code
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,10 @@ | ||
.dcx-code { | ||
color: token('color-text-pre_body'); | ||
font-size: token('font-size-pre_body'); | ||
font-family: token('font-family-pre_body'); | ||
font-weight: token('font-weight-pre_body'); | ||
background: token('color-background-pre_box'); | ||
padding: token('spacing-pre_box'); | ||
} | ||
|
||
|
This file contains hidden or 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 hidden or 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 hidden or 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/CodeSnippet/design-system/AccessibleTheme.stories.js
This file contains hidden or 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 { CodeSnippet } from '../../../src/codesnippet/CodeSnippet'; | ||
/* eslint-disable import/no-webpack-loader-syntax */ | ||
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/CodeSnippet/Design system/Accessible', | ||
component: CodeSnippet, | ||
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-code', style)} | ||
disabled={true} | ||
language="css" | ||
> | ||
<LiveEditor className="liveEditor" aria-label="editor" /> | ||
</LiveProvider> | ||
), | ||
}; | ||
|
||
export const Default = { | ||
name: 'Default', | ||
args: { | ||
value: 'This is the content of the code snippet.', | ||
}, | ||
}; |
This file contains hidden or 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,62 @@ | ||
import { CodeSnippet } from '../../../src/codesnippet/CodeSnippet'; | ||
// 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/CodeSnippet/Design system/Dark', | ||
component: CodeSnippet, | ||
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-code', 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: 'This is the content of the code snippet.', | ||
}, | ||
}; |
This file contains hidden or 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 { CodeSnippet } from '../../../src/codesnippet/CodeSnippet'; | ||
/** | ||
* Here we display the code snippet, importing only the base Design System styles. | ||
*/ | ||
export default { | ||
title:'DCXLibrary/Typography/CodeSnippet/Design system/Default', | ||
component: CodeSnippet, | ||
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: 'This is the content of the code snippet.', | ||
}, | ||
}; | ||
|
54 changes: 54 additions & 0 deletions
54
stories/CodeSnippet/design-system/MaterialTheme.stories.js
This file contains hidden or 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,54 @@ | ||
import { CodeSnippet } from '../../../src/codesnippet/CodeSnippet'; | ||
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/CodeSnippet/Design system/Material', | ||
component: CodeSnippet, | ||
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-code', style)} | ||
disabled={true} | ||
language="css" | ||
> | ||
<LiveEditor className="liveEditor" aria-label="editor" /> | ||
</LiveProvider> | ||
), | ||
}; | ||
|
||
export const Default = { | ||
name: 'Default', | ||
args: { | ||
value: 'This is the content of the code snippet.', | ||
}, | ||
}; |
This file contains hidden or 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 @@ | ||
/* eslint-disable import/no-webpack-loader-syntax */ | ||
import style from '!raw-loader!../../../dist/design-system/code-snippet.css'; | ||
import TokensDecorator from '../../../core/storybook/TokensDecorator'; | ||
import { CodeSnippet } from '../../../src/codesnippet/CodeSnippet'; | ||
|
||
export default { | ||
title: 'DCXLibrary/Typography/CodeSnippet/Design system', | ||
component: CodeSnippet, | ||
decorators: [ | ||
(getStory) => ( | ||
<TokensDecorator style={style}> | ||
{getStory()} | ||
</TokensDecorator> | ||
) | ||
], | ||
parameters: { | ||
options: { showPanel: true }, | ||
actions: { disable: true }, | ||
} | ||
}; | ||
|
||
export const Default = { | ||
name: 'Playground', | ||
args: { | ||
value: 'This is the content of the code snippet.', | ||
}, | ||
}; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.