Skip to content

Commit

Permalink
chore: adds stories for globalStatus prop
Browse files Browse the repository at this point in the history
  • Loading branch information
langz authored and tujoworker committed May 31, 2023
1 parent 5bcf549 commit 173b040
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
IconPrimary,
Button,
FormRow,
GlobalStatus,
} from '../..'
import { Anchor } from '../../../'
import { Context } from '../../../shared'
Expand Down Expand Up @@ -908,3 +909,19 @@ export function DataSuffix() {
</WideStyle>
)
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Autocomplete
no_animation
label="Label:"
data={numbers}
search_numbers
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Wrapper, Box } from 'storybook-utils/helpers'
import styled from '@emotion/styled'

import Button from '../Button'
import { GlobalStatus } from '../..'

const WrappedButton = styled(Button)`
/* width: 10rem; */
Expand Down Expand Up @@ -345,3 +346,16 @@ export const IconButton = Template.bind({})
IconButton.args = {
icon: 'bell',
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Button
text="Text"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react'
import { Wrapper, Box } from 'storybook-utils/helpers'
import styled from '@emotion/styled'

import { Checkbox, Button, FormLabel, FormRow } from '../..'
import { Checkbox, Button, FormLabel, FormRow, GlobalStatus } from '../..'

export default {
title: 'Eufemia/Components/Checkbox',
Expand Down Expand Up @@ -143,3 +143,16 @@ function ControlledVsUncontrolled() {
</>
)
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Checkbox
label="Checkbox"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
Dropdown,
Input,
Section,
GlobalStatus,
} from '../..'

export default {
Expand Down Expand Up @@ -498,3 +499,19 @@ const CustomDate = () => {
// </Section>
// )
// }

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<DatePicker
label="Date Picker 1:"
right="small"
date="1981-01-15"
title="My Button"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
FormRow,
NumberFormat,
Drawer,
GlobalStatus,
} from '../..'
import { Link } from '../../..'
import { DrawerListData } from '../../../fragments/DrawerList'
Expand Down Expand Up @@ -986,3 +987,17 @@ export function UpdateData() {
</>
)
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Dropdown
title="Default"
data={dropdownData}
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Space,
Dialog,
HelpButton,
GlobalStatus,
} from '../..'
import { Link } from '../../..'

Expand Down Expand Up @@ -204,3 +205,17 @@ export const ToggleAnimation = () => {
</Wrapper>
)
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<FormStatus
globalStatus={{ id: 'my-id', message: 'my message' }}
state="error"
>
Some text
</FormStatus>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
FormSet,
FormRow,
FormLabel,
GlobalStatus,
} from '../..'
import InputPassword from '../InputPassword'
import { format } from '../../number-format/NumberUtils'
Expand Down Expand Up @@ -536,3 +537,16 @@ export function ControlledInput() {
</>
)
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Input
title="Default"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
FormLabel,
Button,
HelpButton,
GlobalStatus,
} from '../..'

import { H2 } from '../../..'
Expand Down Expand Up @@ -287,3 +288,17 @@ const shuffleArray = (arr) =>
.map((a) => [Math.random(), a])
.sort((a, b) => a[0] - b[0])
.map((a) => a[1])

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Radio
label="First"
value="first"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React from 'react'
import { Wrapper, Box } from 'storybook-utils/helpers'

import { Switch, FormLabel, HelpButton } from '../..'
import { Switch, FormLabel, HelpButton, GlobalStatus } from '../..'

export default {
title: 'Eufemia/Components/Switch',
Expand Down Expand Up @@ -83,3 +83,17 @@ export const SwitchSandbox = () => (
</Box>
</Wrapper>
)

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Switch
label="First"
value="first"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react'
import { Wrapper, Box } from 'storybook-utils/helpers'

import Provider from '../../../shared/Provider'
import { Textarea, FormRow } from '../..'
import { Textarea, FormRow, GlobalStatus } from '../..'

export default {
title: 'Eufemia/Components/Textarea',
Expand Down Expand Up @@ -149,3 +149,17 @@ export const TextareaSandbox = () => (
</Box>
</Wrapper>
)

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<Textarea
label="First"
value="first"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
// FormSet,
FormRow,
FormLabel,
GlobalStatus,
} from '../..'

import { H2 } from '../../..'
Expand Down Expand Up @@ -404,3 +405,18 @@ export function MultiselectRerender() {
</>
)
}

export const GlobalStatusExample = () => {
return (
<>
<GlobalStatus id="my-id" />
<ToggleButton
variant="checkbox"
text="Item 3"
value="item_3"
globalStatus={{ id: 'my-id', message: 'my message' }}
status="Message"
/>
</>
)
}

0 comments on commit 173b040

Please sign in to comment.