agroptima-design-system 0.22.3 → 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/atoms/EmptyState.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { classNames } from '../utils/classNames'
|
|
2
|
-
import { Button, ButtonProps } from './Button'
|
|
3
2
|
import './EmptyState.scss'
|
|
4
3
|
import { Icon, IconType } from './Icon'
|
|
5
4
|
|
|
@@ -7,25 +6,21 @@ export type Variant = 'primary'
|
|
|
7
6
|
|
|
8
7
|
export interface EmptyStateProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
9
8
|
icon?: IconType
|
|
10
|
-
text?: string
|
|
11
9
|
variant?: Variant
|
|
12
|
-
button?: ButtonProps
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
export function EmptyState({
|
|
16
13
|
className,
|
|
17
14
|
icon = 'EmptyState',
|
|
18
|
-
text = 'No data',
|
|
19
15
|
variant = 'primary',
|
|
20
|
-
|
|
16
|
+
children,
|
|
21
17
|
}: EmptyStateProps): React.JSX.Element {
|
|
22
18
|
const cssClasses = classNames('empty-state', variant, className)
|
|
23
19
|
|
|
24
20
|
return (
|
|
25
21
|
<div className={cssClasses}>
|
|
26
22
|
<Icon name={icon} />
|
|
27
|
-
|
|
28
|
-
{button?.label && <Button {...button} />}
|
|
23
|
+
{children}
|
|
29
24
|
</div>
|
|
30
25
|
)
|
|
31
26
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Button } from '../atoms/Button'
|
|
2
|
+
import { EmptyState } from '../atoms/EmptyState'
|
|
3
|
+
|
|
4
|
+
const figmaPrimaryDesign = {
|
|
5
|
+
design: {
|
|
6
|
+
type: 'figma',
|
|
7
|
+
url: 'https://www.figma.com/file/DN2ova21vWqCRvPspBXgI1/Design-System?type=design&node-id=1719-258&mode=dev',
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Design System/Atoms/EmptyState',
|
|
13
|
+
component: EmptyState,
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {
|
|
16
|
+
icon: {
|
|
17
|
+
description: 'A default icon is set for the empty state.',
|
|
18
|
+
},
|
|
19
|
+
variant: {
|
|
20
|
+
description: 'Variant used.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
parameters: figmaPrimaryDesign,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default meta
|
|
27
|
+
|
|
28
|
+
export const PrimaryCustom = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<EmptyState variant="primary">
|
|
31
|
+
<p>
|
|
32
|
+
There are no videogames yet. You can import videogames to your{' '}
|
|
33
|
+
<a href="#">list</a>.
|
|
34
|
+
</p>
|
|
35
|
+
<Button label="Import videogames" onClick={() => alert('click')}></Button>
|
|
36
|
+
</EmptyState>
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const PrimaryBasic = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<EmptyState variant="primary">
|
|
43
|
+
<p>No data</p>
|
|
44
|
+
</EmptyState>
|
|
45
|
+
),
|
|
46
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"@/*": ["./src/*"]
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/stories/CardsTable.stories.js", "src/stories/Modal.stories.js", "src/stories/Typography.stories.mdx", "src/stories/Card.stories.js", "src/stories/Menu.stories.js"],
|
|
25
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/stories/CardsTable.stories.js", "src/stories/Modal.stories.js", "src/stories/Typography.stories.mdx", "src/stories/Card.stories.js", "src/stories/Menu.stories.js", "src/stories/EmptyState.stories.js"],
|
|
26
26
|
"exclude": ["node_modules"]
|
|
27
27
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { EmptyState } from '../atoms/EmptyState'
|
|
2
|
-
import { StoryObj } from '@storybook/react'
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Design System/Atoms/EmptyState',
|
|
6
|
-
component: EmptyState,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {
|
|
9
|
-
icon: {
|
|
10
|
-
description: 'A default icon is set for the empty state.',
|
|
11
|
-
},
|
|
12
|
-
text: {
|
|
13
|
-
description: 'Label used to describe the empty state.',
|
|
14
|
-
},
|
|
15
|
-
variant: {
|
|
16
|
-
description: 'Variant used.',
|
|
17
|
-
},
|
|
18
|
-
buttonLabel: {
|
|
19
|
-
description: 'Label used on the button.',
|
|
20
|
-
},
|
|
21
|
-
action: {
|
|
22
|
-
description: 'Action called when button is pressed.',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const figmaPrimaryDesign = {
|
|
28
|
-
design: {
|
|
29
|
-
type: 'figma',
|
|
30
|
-
url: 'https://www.figma.com/file/DN2ova21vWqCRvPspBXgI1/Design-System?type=design&node-id=1719-258&mode=dev',
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default meta
|
|
35
|
-
type Story = StoryObj<typeof meta>
|
|
36
|
-
|
|
37
|
-
export const PrimaryCustom: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
variant: 'primary',
|
|
40
|
-
text: 'There are no videogames yet. You can import videogames to your list.',
|
|
41
|
-
button: {
|
|
42
|
-
label: 'Import videogames',
|
|
43
|
-
onClick: () => alert('click'),
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
parameters: figmaPrimaryDesign,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const PrimaryBasic: Story = {
|
|
50
|
-
args: {
|
|
51
|
-
variant: 'primary',
|
|
52
|
-
},
|
|
53
|
-
parameters: figmaPrimaryDesign,
|
|
54
|
-
}
|