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.0",
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.3",
19
- "@storybook/addon-viewport": "^8.3.2",
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.0.2",
27
- "@storybook/addon-a11y": "^8.3.2",
28
- "@storybook/addon-essentials": "^8.3.2",
29
- "@storybook/addon-interactions": "^8.3.2",
30
- "@storybook/addon-links": "^8.3.2",
31
- "@storybook/blocks": "^8.3.2",
32
- "@storybook/nextjs": "^8.3.2",
33
- "@storybook/react": "^8.3.2",
34
- "@storybook/test": "^8.3.2",
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.8.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.3.2",
52
+ "storybook": "^8.4.2",
53
53
  "ts-node": "^10.9.2",
54
54
  "typescript": "^5"
55
55
  },
@@ -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;
@@ -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 extends React.ComponentPropsWithoutRef<'div'> {
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): React.JSX.Element {
23
- const cssClasses = classNames('card', className, variant, {
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
  }
@@ -33,6 +33,10 @@
33
33
  width: 100%;
34
34
  }
35
35
 
36
+ .hidden {
37
+ display: none !important;
38
+ }
39
+
36
40
  .only-desktop {
37
41
  @media only screen and (max-width: breakpoints.$large) {
38
42
  display: none !important;
@@ -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
+ }
@@ -4,6 +4,9 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ # 0.27.1
8
+
9
+ * Update Card with href prop
7
10
 
8
11
  # 0.27.0
9
12