agroptima-design-system 0.27.0 → 0.27.1-beta.2
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agroptima-design-system",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.1-beta.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "npm run storybook",
|
|
6
6
|
"storybook": "storybook dev -p 6006 --ci",
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
"publish:beta": "npm publish --tag beta"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@storybook/addon-designs": "^8.0.
|
|
19
|
-
"@storybook/addon-viewport": "^8.
|
|
18
|
+
"@storybook/addon-designs": "^8.0.4",
|
|
19
|
+
"@storybook/addon-viewport": "^8.4.2",
|
|
20
20
|
"next": "^14.0.3",
|
|
21
21
|
"react": "^18.2.0",
|
|
22
22
|
"react-dom": "^18.2.0",
|
|
23
23
|
"sass": "^1.69.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@chromatic-com/storybook": "^2.
|
|
27
|
-
"@storybook/addon-a11y": "^8.
|
|
28
|
-
"@storybook/addon-essentials": "^8.
|
|
29
|
-
"@storybook/addon-interactions": "^8.
|
|
30
|
-
"@storybook/addon-links": "^8.
|
|
31
|
-
"@storybook/blocks": "^8.
|
|
32
|
-
"@storybook/nextjs": "^8.
|
|
33
|
-
"@storybook/react": "^8.
|
|
34
|
-
"@storybook/test": "^8.
|
|
26
|
+
"@chromatic-com/storybook": "^3.2.2",
|
|
27
|
+
"@storybook/addon-a11y": "^8.4.2",
|
|
28
|
+
"@storybook/addon-essentials": "^8.4.2",
|
|
29
|
+
"@storybook/addon-interactions": "^8.4.2",
|
|
30
|
+
"@storybook/addon-links": "^8.4.2",
|
|
31
|
+
"@storybook/blocks": "^8.4.2",
|
|
32
|
+
"@storybook/nextjs": "^8.4.2",
|
|
33
|
+
"@storybook/react": "^8.4.2",
|
|
34
|
+
"@storybook/test": "^8.4.2",
|
|
35
35
|
"@svgr/webpack": "^8.1.0",
|
|
36
36
|
"@testing-library/jest-dom": "^6.4.2",
|
|
37
37
|
"@testing-library/react": "^16.0.0",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"eslint-config-next": "^14.0.3",
|
|
46
46
|
"eslint-config-prettier": "^9.0.0",
|
|
47
47
|
"eslint-plugin-prettier": "^5.0.1",
|
|
48
|
-
"eslint-plugin-storybook": "^0.
|
|
48
|
+
"eslint-plugin-storybook": "^0.11.0",
|
|
49
49
|
"jest": "^29.7.0",
|
|
50
50
|
"jest-axe": "^9.0.0",
|
|
51
51
|
"jest-environment-jsdom": "^29.7.0",
|
|
52
|
-
"storybook": "^8.
|
|
52
|
+
"storybook": "^8.4.2",
|
|
53
53
|
"ts-node": "^10.9.2",
|
|
54
54
|
"typescript": "^5"
|
|
55
55
|
},
|
package/src/atoms/Card/Card.scss
CHANGED
|
@@ -3,17 +3,22 @@
|
|
|
3
3
|
@use '../../settings/config';
|
|
4
4
|
@use '../../settings/breakpoints';
|
|
5
5
|
|
|
6
|
+
a.card {
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
&:hover {
|
|
9
|
+
background-color: color_alias.$primary-color-50;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
.card {
|
|
7
14
|
display: flex;
|
|
8
15
|
flex-direction: column;
|
|
9
16
|
gap: config.$space-1x;
|
|
10
17
|
padding: config.$space-3x;
|
|
11
18
|
width: 100%;
|
|
12
|
-
|
|
13
19
|
p {
|
|
14
20
|
margin: 0;
|
|
15
21
|
}
|
|
16
|
-
|
|
17
22
|
.actions {
|
|
18
23
|
display: flex;
|
|
19
24
|
gap: config.$space-4x;
|
package/src/atoms/Card/Card.tsx
CHANGED
|
@@ -1,31 +1,48 @@
|
|
|
1
1
|
import './Card.scss'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { classNames } from '../../utils/classNames'
|
|
4
|
+
import Link from 'next/link'
|
|
4
5
|
|
|
5
6
|
export type Variant = 'primary'
|
|
6
7
|
|
|
7
|
-
export interface CardProps
|
|
8
|
+
export interface CardProps {
|
|
9
|
+
visible?: boolean
|
|
10
|
+
className?: string
|
|
8
11
|
variant?: Variant
|
|
9
12
|
isDisabled?: boolean
|
|
10
13
|
isActive?: boolean
|
|
11
14
|
error?: boolean
|
|
15
|
+
href?: string
|
|
16
|
+
children: React.ReactNode
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export function Card({
|
|
15
20
|
className,
|
|
21
|
+
visible = true,
|
|
16
22
|
variant = 'primary',
|
|
17
23
|
isDisabled = false,
|
|
18
24
|
isActive = false,
|
|
19
25
|
error = false,
|
|
20
26
|
children,
|
|
27
|
+
href,
|
|
21
28
|
...props
|
|
22
|
-
}: CardProps)
|
|
23
|
-
|
|
29
|
+
}: CardProps) {
|
|
30
|
+
if (!visible) return null
|
|
31
|
+
|
|
32
|
+
const cssClasses = classNames('card', variant, className, {
|
|
24
33
|
disabled: isDisabled,
|
|
25
34
|
active: isActive,
|
|
26
35
|
error: error,
|
|
27
36
|
})
|
|
28
37
|
|
|
38
|
+
if (href && !isDisabled) {
|
|
39
|
+
return (
|
|
40
|
+
<Link href={href} className={cssClasses} {...props}>
|
|
41
|
+
{children}
|
|
42
|
+
</Link>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
29
46
|
return (
|
|
30
47
|
<article className={cssClasses} {...props}>
|
|
31
48
|
{children}
|
|
@@ -19,7 +19,7 @@ export function CardHeader({
|
|
|
19
19
|
return (
|
|
20
20
|
<div className={cssClasses} {...props}>
|
|
21
21
|
<span className={classNames('title', { bold: isBold })}>{title}</span>
|
|
22
|
-
<div className="actions">{children}</div>
|
|
22
|
+
{children && <div className="actions">{children}</div>}
|
|
23
23
|
</div>
|
|
24
24
|
)
|
|
25
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconButton } from '../atoms/Button'
|
|
2
2
|
import { Card, CardHeader, CardContent, CardFooter } from '../atoms/Card'
|
|
3
3
|
import { Button } from '../atoms/Button'
|
|
4
|
+
import { type } from 'os'
|
|
4
5
|
|
|
5
6
|
const figmaPrimaryDesign = {
|
|
6
7
|
design: {
|
|
@@ -14,17 +15,36 @@ const meta = {
|
|
|
14
15
|
component: Card,
|
|
15
16
|
tags: ['autodocs'],
|
|
16
17
|
argTypes: {
|
|
18
|
+
visible: {
|
|
19
|
+
description: 'Is component visible?',
|
|
20
|
+
control: 'boolean',
|
|
21
|
+
},
|
|
17
22
|
variant: {
|
|
18
23
|
description: 'Component variant used',
|
|
19
24
|
},
|
|
25
|
+
isActive: {
|
|
26
|
+
description: 'Is component active?',
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
},
|
|
29
|
+
error: {
|
|
30
|
+
description: 'Has component an error?',
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
},
|
|
20
33
|
isBold: {
|
|
21
34
|
description: 'Is component title shown with bold style?',
|
|
35
|
+
control: 'boolean',
|
|
22
36
|
},
|
|
23
37
|
title: {
|
|
24
38
|
description: 'Title text',
|
|
39
|
+
control: 'text',
|
|
25
40
|
},
|
|
26
41
|
isDisabled: {
|
|
27
42
|
description: 'Is component disabled?',
|
|
43
|
+
control: 'text',
|
|
44
|
+
},
|
|
45
|
+
href: {
|
|
46
|
+
description: 'Link to redirect when clicking on the card',
|
|
47
|
+
control: 'text',
|
|
28
48
|
},
|
|
29
49
|
},
|
|
30
50
|
parameters: figmaPrimaryDesign,
|
|
@@ -465,3 +485,20 @@ export const Active = {
|
|
|
465
485
|
</div>
|
|
466
486
|
),
|
|
467
487
|
}
|
|
488
|
+
|
|
489
|
+
export const WithLink = {
|
|
490
|
+
render: () => (
|
|
491
|
+
<div style={{ display: 'flex' }}>
|
|
492
|
+
<Card href="some-url">
|
|
493
|
+
<CardHeader title="Fallout 3" isBold />
|
|
494
|
+
<CardContent>
|
|
495
|
+
<p>
|
|
496
|
+
Fallout 3 is a post-apocalyptic action role-playing open world video
|
|
497
|
+
game developed by Bethesda Game Studios and published by Bethesda
|
|
498
|
+
Softworks.
|
|
499
|
+
</p>
|
|
500
|
+
</CardContent>
|
|
501
|
+
</Card>
|
|
502
|
+
</div>
|
|
503
|
+
),
|
|
504
|
+
}
|