-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alert): update alert attributes (#275)
* feat(alert): update alert attributes DSY-2760 Co-authored-by: Design system Natura in behalf of Design System Team <[email protected]>
- Loading branch information
1 parent
78f878b
commit 7d71f08
Showing
8 changed files
with
531 additions
and
1,307 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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { storiesOf } from '@storybook/react-native' | ||
import { All, Interactive } from './Alert.stories' | ||
import { | ||
Default, Variants, Types, Icon, Title, Interactive | ||
} from './Alert.stories' | ||
|
||
storiesOf('Alert', module) | ||
.add('Variants', All) | ||
.add('Default', Default) | ||
.add('Variants', Variants) | ||
.add('Icon', Icon) | ||
.add('Title', Title) | ||
.add('Types', Types) | ||
.add('Interactive', Interactive) |
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 |
---|---|---|
@@ -1,58 +1,144 @@ | ||
import React from 'react' | ||
import { select, text as textKnob } from '@storybook/addon-knobs' | ||
import { select, text } from '@storybook/addon-knobs' | ||
import { Alert } from './Alert' | ||
|
||
import { | ||
Variants, | ||
Types | ||
} from './Alert.styles' | ||
import { StoryContainer, StoryWrapper } from '../../common/HelperComponents/StoryContainer' | ||
import { Types as TypesProps, Variants as VariantsProps } from './Alert.types' | ||
|
||
const description = () => ` | ||
--- | ||
**NOTE**: This component is available in the following types: | ||
- ✅ Standard | ||
With the following attribute status: | ||
- **Type:** (available as variant) | ||
- ✅ \`contained\` (available as standard) | ||
- ✅ \`outlined\` | ||
- **Color:** (available as type) | ||
- ✅ \`success\` | ||
- ✅ \`error\` | ||
- ✅ \`warning\` | ||
- ✅ \`info\` | ||
- ✅ \`custom\` | ||
- ✅ **Title** | ||
- ✅ **Icon** | ||
--- | ||
` | ||
|
||
const alertDefinition = 'An alert displays a short, important message in a way that attracts the user\'s attention without interrupting the user\'s task.' | ||
|
||
export default { | ||
component: Alert, | ||
parameters: { | ||
componentSubtitle: alertDefinition | ||
componentSubtitle: alertDefinition, | ||
docs: { | ||
extractComponentDescription: description | ||
} | ||
}, | ||
title: 'Components|Alert' | ||
} | ||
|
||
const types = { | ||
const typesMap = { | ||
error: 'error', | ||
info: 'info', | ||
success: 'success', | ||
warning: 'warning' | ||
warning: 'warning', | ||
custom: 'custom' | ||
} | ||
|
||
const variants = { | ||
standard: 'standard' | ||
const variantsMap = { | ||
standard: 'standard', | ||
outlined: 'outlined', | ||
filled: 'filled' | ||
} | ||
|
||
export const All = () => ( | ||
export const Default = () => ( | ||
<StoryWrapper title="Default"> | ||
<StoryContainer title="Standard"> | ||
<Alert title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
</StoryWrapper> | ||
) | ||
|
||
export const Variants = () => ( | ||
<StoryWrapper title="Variants"> | ||
<StoryContainer title="Standard"> | ||
<Alert variant="standard" title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="Outlined"> | ||
<Alert variant="outlined" title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
</StoryWrapper> | ||
) | ||
|
||
export const Icon = () => ( | ||
<StoryWrapper title="Icon"> | ||
<StoryContainer title="Without Icon"> | ||
<Alert icon={false} title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="With Icon"> | ||
<Alert title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
</StoryWrapper> | ||
) | ||
|
||
export const Title = () => ( | ||
<StoryWrapper title="Title"> | ||
<StoryContainer title="Without Title"> | ||
<Alert message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="With Title"> | ||
<Alert title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
</StoryWrapper> | ||
) | ||
|
||
export const Types = () => ( | ||
<StoryWrapper title="Types"> | ||
<StoryContainer title="Info"> | ||
<Alert type="info" title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="Success"> | ||
<Alert type="success" variant="standard" title="Title" message={alertDefinition} /> | ||
<Alert type="success" title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="Error"> | ||
<Alert type="error" variant="standard" title="Title" message={alertDefinition} /> | ||
<Alert type="error" title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="Warning"> | ||
<Alert type="warning" variant="standard" title="Title" message={alertDefinition} /> | ||
<Alert type="warning" title="Title" message={alertDefinition} /> | ||
</StoryContainer> | ||
|
||
<StoryContainer title="Info"> | ||
<Alert type="info" variant="standard" title="Title" message={alertDefinition} /> | ||
<StoryContainer title="Custom"> | ||
<Alert | ||
type="custom" | ||
title="Title" | ||
message={alertDefinition} | ||
variant="outlined" | ||
backgroundColorName="secondaryDark" | ||
borderColorName="secondaryDark" | ||
titleColorName="secondaryDark" | ||
messageColorName="secondaryDark" | ||
iconColorName="secondaryDark" | ||
/> | ||
</StoryContainer> | ||
</StoryWrapper> | ||
) | ||
|
||
export const Interactive = () => ( | ||
<Alert | ||
title={textKnob('Text', 'Title')} | ||
variant={select('Variant', variants, 'standard') as Variants} | ||
type={select('Type', types, 'success') as Types} | ||
message={textKnob('Message', alertDefinition)} | ||
title={text('Text', 'Title')} | ||
variant={select('Variant', variantsMap, 'standard') as VariantsProps} | ||
type={select('Type', typesMap, 'info') as TypesProps} | ||
message={text('Message', alertDefinition)} | ||
/> | ||
) |
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
Oops, something went wrong.