-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make it possible to send in a custom component as the #form-sta…
…tus content instead of only plain text
- Loading branch information
1 parent
7326f3d
commit 075114a
Showing
39 changed files
with
233 additions
and
139 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
71 changes: 71 additions & 0 deletions
71
packages/dnb-design-system-portal/src/docs/uilib/components/form-status/Examples.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,71 @@ | ||
/** | ||
* UI lib Component Example | ||
* | ||
*/ | ||
|
||
import React, { PureComponent, Fragment } from 'react' | ||
import ComponentBox from 'Src/shared/tags/ComponentBox' | ||
|
||
class Example extends PureComponent { | ||
render() { | ||
return ( | ||
<Fragment> | ||
<ComponentBox | ||
caption="FormStatus displaying error status" | ||
data-dnb-test="form-status" | ||
> | ||
{/* @jsx */ ` | ||
<FormStatus | ||
text="Failure text" | ||
/> | ||
`} | ||
</ComponentBox> | ||
<ComponentBox | ||
caption="FormStatus displaying info status" | ||
data-dnb-test="form-status-info" | ||
> | ||
{/* @jsx */ ` | ||
<FormStatus | ||
title="Hover title" | ||
text="Long info nisl tempus hendrerit tortor dapibus nascetur taciti porta risus cursus fusce platea enim curabitur proin nibh ut luctus magnis metus" | ||
status="info" | ||
/> | ||
`} | ||
</ComponentBox> | ||
<ComponentBox caption="A form status, used by the Input Component"> | ||
{/* @jsx */ ` | ||
<Input | ||
label="Input with status:" | ||
status="You have to fill in this field" | ||
value="Input value" | ||
/> | ||
`} | ||
</ComponentBox> | ||
<ComponentBox | ||
caption="A form status, with a custom styled content" | ||
data-dnb-test="form-status-custom" | ||
useRender | ||
> | ||
{/* @jsx */ ` | ||
const CustomStatus = () => ( | ||
<> | ||
My info <Link href="/">with a link</Link> and more text | ||
</> | ||
) | ||
render( | ||
<Input | ||
label="Input with custom content:" | ||
status={ <CustomStatus /> } | ||
status_state="info" | ||
value="Input value" | ||
/> | ||
) | ||
`} | ||
</ComponentBox> | ||
</Fragment> | ||
) | ||
} | ||
} | ||
|
||
export { Example } | ||
export default () => <Example /> |
16 changes: 16 additions & 0 deletions
16
...-design-system-portal/src/docs/uilib/components/form-status/form-status-info.md
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,16 @@ | ||
--- | ||
draft: true | ||
--- | ||
|
||
import Examples from 'Pages/uilib/components/form-status/Examples' | ||
|
||
## Description | ||
|
||
The `FormStatus` is a simple component meant for displaying the status of a form ( displaying form errors, messages etc. ) | ||
The `FormStatus` component should be positioned relative to the form or form input to which it referring to. | ||
|
||
Also, the `FormStatus` is used inside of many other form components. | ||
|
||
## Demos | ||
|
||
<Examples /> |
11 changes: 11 additions & 0 deletions
11
...n-system-portal/src/docs/uilib/components/form-status/form-status-properties.md
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,11 @@ | ||
--- | ||
draft: true | ||
--- | ||
|
||
| Properties | Description | | ||
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `text|children` | _(optional)_ the `text` appears as the status message. Beside plain text, You can send in a React component as well. | | ||
| `title` | _(optional)_ the `title` attribute in the status. | | ||
| `status` | _(optional)_ defines the visual appearance of the status. There are two main statuses `error` and `info`. The default status is `error`. | | ||
| `icon` | _(optional)_ the `icon` show before the status text. Defaults to `exclamation`. | | ||
| `icon_size` | _(optional)_ the icon size of the icon shows. Defaults to `medium`. | |
44 changes: 0 additions & 44 deletions
44
packages/dnb-design-system-portal/src/uilib/components/demos/FormStatus.js
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/dnb-design-system-portal/src/uilib/components/examples/FormStatus.txt
This file was deleted.
Oops, something went wrong.
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
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
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
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 was deleted.
Oops, something went wrong.
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
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
Binary file added
BIN
+11 KB
...ot-test-js-form-status-screenshot-have-to-match-custom-content-1-f2fd5.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.1 KB
...ot-test-js-form-status-screenshot-have-to-match-the-info-state-1-8d514.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions
4
packages/dnb-ui-lib/src/components/form-status/description.md
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,8 +4,6 @@ | |
*/ | ||
|
||
.dnb-form-status { | ||
width: auto; | ||
|
||
display: flex; | ||
|
||
&__shell { | ||
|
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
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.