-
Notifications
You must be signed in to change notification settings - Fork 3
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
4fa4367
commit 3bbbd4d
Showing
3 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs' | ||
import { FormError } from './FormError' | ||
|
||
<Meta title="Components/Form/FormError" component={FormError} /> | ||
|
||
# FormError | ||
|
||
This component is a variation of the [Alert](/docs/components-alert-alert--default-story) component. | ||
Its main purpose is to provide an Alert which goes over to 2 columns, and it is used in combination with the component [SectionContentTwoColumn](/docs/components-section-sectioncontenttwocolumn--default-story). | ||
|
||
export const Template = ({ children, ...args }) => ( | ||
<FormError {...args}>{children}</FormError> | ||
) | ||
|
||
<Canvas> | ||
<Story name="Default" args={{ children: 'Critical Message.' }}> | ||
{Template.bind({})} | ||
</Story> | ||
</Canvas> | ||
|
||
### Props | ||
|
||
<ArgsTable story="Default" /> | ||
|
||
### Theme | ||
|
||
- `form.formError.base`: Defines base styles of container |
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,12 @@ | ||
import { useTheme } from '../../framework/theme/ThemeContext' | ||
import { Alert, Tone } from '../alert' | ||
|
||
export const FormError: React.FC = ({ children }) => { | ||
const { form } = useTheme() | ||
|
||
return ( | ||
<Alert tone={Tone.critical} className={form.formError.base}> | ||
{children} | ||
</Alert> | ||
) | ||
} |
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