Skip to content

Commit

Permalink
Merge branch 'release/1.0.0' into feature/ds-preformatted-text
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-zurico authored Nov 20, 2023
2 parents 193e89b + f191be4 commit a4193c5
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 1 deletion.
1 change: 1 addition & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
href="https://www.capgemini.com/wp-content/themes/capgemini-komposite/assets/images/favicon.ico">
<link rel="icon" type="image/png" href="/storybook.png" sizes="192x192">
<!-- TODO-DS: we'll remove this one when we'll decide to release the design tokens-->
<meta name="description" content="react agnostic library" key="desc" />
<script defer>
if (location.hostname !== 'localhost') {
const $hideDesignSystemFromSidebar = document.createElement('style');
Expand Down
12 changes: 12 additions & 0 deletions src/design-system/abbreviate.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.dcx-abbreviate {
background: token('color-background-highlight_body');
border-radius: token('border-radius-abbreviate');
color: token('color-text-body');
font-family: token('font-family-body');
font-size: token('font-size-body');
font-weight: token('font-weight-body');
margin: 0;
padding: token('spacing-y-abbreviate') token('spacing-x-abbreviate');
text-decoration: none;
cursor: help;
}
1 change: 1 addition & 0 deletions src/design-system/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
@import './insert-text.css';
@import './heading.css';
@import './highlight.css';
@import './abbreviate.css';
@import './keyboard-input.css';
@import './preformattedText.css';
5 changes: 4 additions & 1 deletion src/design-system/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"border-radius-action": "6px",
"border-radius-formcontrol": "4px",
"border-radius-formcontrol-floating": "4px",
"border-radius-abbreviate": "3px",
"border-style-action": "solid",
"border-width-action": "1px",
"box-shadow-action": "0px 8px 15px rgba(0, 0, 0, 0.1)",
Expand Down Expand Up @@ -132,5 +133,7 @@
"spacing-x-formcontrol-floating-filled": "15px",
"spacing-y-action": "10px",
"spacing-y-formcontrol": "15px",
"spacing-y-formcontrol-floating": "30px"
"spacing-y-formcontrol-floating": "30px",
"spacing-y-abbreviate": "0px",
"spacing-x-abbreviate": "0px"
}
59 changes: 59 additions & 0 deletions stories/Abbreviate/design-system/AccessibleTheme.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Abbreviate } from '../../../src/abbreviate/Abbreviate';
import { Paragraph } from '../../../src/paragraph/Paragraph';
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/Abbreviate/Design system/Accessible',
component: Abbreviate,
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-abbreviate', style)}
disabled={true}
language="css"
>
<LiveEditor className="liveEditor" aria-label="editor" />
</LiveProvider>
),
};

export const Default = {
name: 'Default',
args: {
title: 'As soon as possible',
value: 'ASAP',
},
render: ({ title, value }) => (
<Paragraph>
Sorry, i call you <Abbreviate {...{ title, value }} />
</Paragraph>
),
};
69 changes: 69 additions & 0 deletions stories/Abbreviate/design-system/DarkTheme.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Abbreviate } from '../../../src/abbreviate/Abbreviate';
import { Paragraph } from '../../../src/paragraph/Paragraph';
// 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/Abbreviate/Design system/Dark',
component: Abbreviate,
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-abbreviate', 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: {
title: 'As soon as possible',
value: 'ASAP',
},
render: ({ title, value }) => (
<Paragraph>
Sorry, i call you <Abbreviate {...{ title, value }} />
</Paragraph>
),
};
33 changes: 33 additions & 0 deletions stories/Abbreviate/design-system/Default.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Abbreviate } from '../../../src/abbreviate/Abbreviate';
import { Paragraph } from '../../../src/paragraph/Paragraph';
/**
* Here we display the component in its natural abbreviate, importing only the base Design System styles.
*/
export default {
title: 'DCXLibrary/Typography/Abbreviate/Design system/Default',
component: Abbreviate,
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: {
title: 'As soon as possible',
value: 'ASAP',
},
render: ({ title, value }) => (
<Paragraph>
Sorry, i call you <Abbreviate {...{ title, value }} />
</Paragraph>
),
};
61 changes: 61 additions & 0 deletions stories/Abbreviate/design-system/MaterialTheme.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Abbreviate } from '../../../src/abbreviate/Abbreviate';
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';
import { Paragraph } from '../../../src/paragraph/Paragraph';

/**
* 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/Abbreviate/Design system/Material',
component: Abbreviate,
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-abbreviate', style)}
disabled={true}
language="css"
>
<LiveEditor className="liveEditor" aria-label="editor" />
</LiveProvider>
),
};

export const Default = {
name: 'Default',
args: {
title: 'As soon as possible',
value: 'ASAP',
},
render: ({ title, value }) => (
<Paragraph>
Sorry, i call you <Abbreviate {...{ title, value }} />
</Paragraph>
),
};
30 changes: 30 additions & 0 deletions stories/Abbreviate/design-system/Playground.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable import/no-webpack-loader-syntax */
import style from '!raw-loader!../../../dist/design-system/abbreviate.css';
import TokensDecorator from '../../../core/storybook/TokensDecorator';
import { Abbreviate } from '../../../src/abbreviate/Abbreviate';
import { Paragraph } from '../../../src/paragraph/Paragraph';

export default {
title: 'DCXLibrary/Typography/Abbreviate/Design system',
component: Abbreviate,
decorators: [
getStory => <TokensDecorator style={style}>{getStory()}</TokensDecorator>,
],
parameters: {
options: { showPanel: true },
actions: { disable: true },
},
};

export const Playground = {
name: 'Playground',
args: {
title: 'As soon as possible',
value: 'ASAP',
},
render: ({ title, value }) => (
<Paragraph>
Sorry, i call you <Abbreviate {...{ title, value }} />
</Paragraph>
),
};
5 changes: 5 additions & 0 deletions stories/themes/accessible.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
--dcx-color-text-body: #000;
--dcx-color-marker: #000;
}

.dcx-abbreviate {
--dcx-spacing-y-abbreviate: 5px;
--dcx-spacing-x-abbreviate: 5px;
}
4 changes: 4 additions & 0 deletions stories/themes/dark.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
--dcx-color-text-heading-level_6: white;
}

.dcx-abbreviate {
--dcx-color-background-highlight_body: #666;
}

.dcx-link {
--dcx-color-text-link: darkorange;
--dcx-color-text-link-visited: #db7a03;
Expand Down
3 changes: 3 additions & 0 deletions stories/themes/material.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
--dcx-color-text-pre_body: rgba(0, 0, 0, 0.6);
}

.dcx-abbreviate {
--dcx-border-radius-abbreviate: 8px;
}

0 comments on commit a4193c5

Please # to comment.