agroptima-design-system 0.16.1 → 0.16.2-beta.1

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.16.1",
3
+ "version": "0.16.2-beta.1",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -10,7 +10,8 @@
10
10
  "lint:fix": "eslint src --fix",
11
11
  "types": "tsc --noEmit",
12
12
  "chromatic": "npx chromatic --exit-zero-on-changes",
13
- "test": "jest"
13
+ "test": "jest",
14
+ "publish:beta": "npm publish --tag beta"
14
15
  },
15
16
  "dependencies": {
16
17
  "@storybook/addon-designs": "^7.0.5",
@@ -8,6 +8,7 @@
8
8
  flex-direction: column;
9
9
  gap: config.$space-1x;
10
10
  padding: config.$space-3x;
11
+ width: 100%;
11
12
 
12
13
  p {
13
14
  margin: 0;
@@ -57,15 +58,10 @@
57
58
  @include typography.body-regular-disabled;
58
59
  background: color_alias.$neutral-color-50;
59
60
  }
60
- }
61
61
 
62
- // Media queries
63
- // Mobile case
64
- @media only screen and (min-width: breakpoints.$small) and (max-width: breakpoints.$medium) {
65
- width: 100%;
66
- }
67
- // Tablet & Desktop cases
68
- @media only screen and (min-width: breakpoints.$medium) {
69
- width: 18.625rem;
62
+ &.active {
63
+ border: 1px solid color_alias.$primary-color-1000;
64
+ box-shadow: none;
65
+ }
70
66
  }
71
67
  }
@@ -7,22 +7,25 @@ export type Variant = 'primary'
7
7
  export interface CardProps extends React.ComponentPropsWithoutRef<'div'> {
8
8
  variant?: Variant
9
9
  isDisabled?: boolean
10
+ isActive?: boolean
10
11
  }
11
12
 
12
13
  export function Card({
13
14
  className,
14
15
  variant = 'primary',
15
16
  isDisabled = false,
17
+ isActive = false,
16
18
  children,
17
19
  ...props
18
20
  }: CardProps): React.JSX.Element {
19
21
  const cssClasses = classNames('card', className, variant, {
20
22
  disabled: isDisabled,
23
+ active: isActive,
21
24
  })
22
25
 
23
26
  return (
24
- <div className={cssClasses} {...props}>
27
+ <article className={cssClasses} {...props}>
25
28
  {children}
26
- </div>
29
+ </article>
27
30
  )
28
31
  }
@@ -13,12 +13,16 @@
13
13
  gap: config.$space-3x;
14
14
  border-radius: config.$corner-radius-xxs;
15
15
  border-bottom: 1px solid color_alias.$neutral-color-200;
16
+ text-decoration: none;
16
17
  cursor: default;
17
-
18
+ &:hover {
19
+ text-decoration: none;
20
+ }
18
21
  @include typography.body-regular-primary;
19
22
 
20
23
  .icon {
21
24
  width: config.$icon-size-4x;
25
+ min-width: config.$icon-size-4x;
22
26
  height: config.$icon-size-4x;
23
27
  > svg {
24
28
  width: 100%;
@@ -54,6 +58,15 @@
54
58
  &.primary {
55
59
  background: color_alias.$neutral-white;
56
60
 
61
+ &.active {
62
+ background-color: color_alias.$primary-color-50;
63
+ }
64
+
65
+ &.error {
66
+ border: 1px solid color_alias.$error-color-600;
67
+ background-color: color_alias.$error-color-50;
68
+ }
69
+
57
70
  .icon {
58
71
  > svg {
59
72
  fill: color_alias.$primary-color-600;
@@ -1,17 +1,21 @@
1
1
  import { Icon, IconType } from '../Icon'
2
2
  import './CardMenu.scss'
3
3
  import { classNames } from '../../utils/classNames'
4
+ import Link, { LinkProps as NextLinkProps } from 'next/link'
4
5
 
5
6
  export type Variant = 'primary'
6
7
 
7
- export interface CardMenuOptionProps
8
- extends React.ComponentPropsWithoutRef<'div'> {
8
+ type LinkProps = NextLinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement>
9
+ export interface CardMenuOptionProps extends LinkProps {
9
10
  id?: string
10
11
  variant?: Variant
11
12
  icon: IconType
12
13
  title: string
13
14
  description?: string
14
15
  disabled?: boolean
16
+ href: string
17
+ active?: boolean
18
+ error?: boolean
15
19
  }
16
20
 
17
21
  export function CardMenuOption({
@@ -22,29 +26,35 @@ export function CardMenuOption({
22
26
  title,
23
27
  description,
24
28
  disabled,
29
+ href,
30
+ active,
31
+ error,
25
32
  ...props
26
33
  }: CardMenuOptionProps): React.JSX.Element {
27
34
  const cssClasses = classNames('card-menu-option', variant, className, {
28
- disabled: disabled,
35
+ disabled,
36
+ active,
37
+ error,
29
38
  })
30
39
 
31
40
  return (
32
- <div
41
+ <Link
33
42
  role="menuitem"
34
43
  className={cssClasses}
35
- {...props}
44
+ href={disabled ? '#' : href}
36
45
  aria-disabled={disabled}
46
+ {...props}
37
47
  >
38
48
  <div className="left">
39
49
  <div className="title-container">
40
50
  <Icon name={icon} className={variant} />
41
51
  <span className="title">{title}</span>
42
52
  </div>
43
- <p className="content">{description}</p>
53
+ {description && <p className="content">{description}</p>}
44
54
  </div>
45
55
  <div className="right">
46
56
  <Icon name="AngleRight" className={variant} />
47
57
  </div>
48
- </div>
58
+ </Link>
49
59
  )
50
60
  }
@@ -399,7 +399,13 @@ export const Primary = {
399
399
  />
400
400
  </CardHeader>
401
401
  <CardContent>
402
- <p>TEKKEN 8 will feature exciting new gameplay focused on “Aggressive” tactics. Retaining TEKKEN's unique fighting game identity, the game will provide both players and spectators with the series' most thrilling experience yet with visceral screen-jarring attacks and environments that are both dynamic and destructible.</p>
402
+ <p>
403
+ TEKKEN 8 will feature exciting new gameplay focused on “Aggressive”
404
+ tactics. Retaining TEKKEN's unique fighting game identity, the game
405
+ will provide both players and spectators with the series' most
406
+ thrilling experience yet with visceral screen-jarring attacks and
407
+ environments that are both dynamic and destructible.
408
+ </p>
403
409
  </CardContent>
404
410
  <CardFooter>
405
411
  <Button variant="primary-outlined" label="Add to wishlist" />
@@ -412,12 +418,18 @@ export const Primary = {
412
418
  export const Disabled = {
413
419
  render: () => (
414
420
  <div style={{ display: 'flex' }}>
415
- <Card isDisabled={true} variant="primary">
421
+ <Card isDisabled variant="primary">
416
422
  <CardHeader title="Tekken 8">
417
423
  <IconButton disabled icon="Delete" accessibilityLabel="Delete game" />
418
424
  </CardHeader>
419
425
  <CardContent>
420
- <p>TEKKEN 8 will feature exciting new gameplay focused on “Aggressive” tactics. Retaining TEKKEN's unique fighting game identity, the game will provide both players and spectators with the series' most thrilling experience yet with visceral screen-jarring attacks and environments that are both dynamic and destructible.</p>
426
+ <p>
427
+ TEKKEN 8 will feature exciting new gameplay focused on “Aggressive”
428
+ tactics. Retaining TEKKEN's unique fighting game identity, the game
429
+ will provide both players and spectators with the series' most
430
+ thrilling experience yet with visceral screen-jarring attacks and
431
+ environments that are both dynamic and destructible.
432
+ </p>
421
433
  </CardContent>
422
434
  <CardFooter>
423
435
  <Button variant="primary-outlined" disabled label="Add to wishlist" />
@@ -426,3 +438,15 @@ export const Disabled = {
426
438
  </div>
427
439
  ),
428
440
  }
441
+
442
+ export const Active = {
443
+ render: () => (
444
+ <div style={{ display: 'flex' }}>
445
+ <Card isActive>
446
+ <CardHeader title="Fallout 3">
447
+ <IconButton icon="Delete" accessibilityLabel="Delete game" />
448
+ </CardHeader>
449
+ </Card>
450
+ </div>
451
+ ),
452
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
 
3
3
  import { CardMenu, CardMenuOption } from '../atoms/CardMenu'
4
+ import { isErrored } from 'stream'
4
5
 
5
6
  const figmaPrimaryDesign = {
6
7
  design: {
@@ -29,11 +30,14 @@ const meta = {
29
30
  description: {
30
31
  description: 'Component description text',
31
32
  },
32
- isDisabled: {
33
+ disabled: {
33
34
  description: 'Is the component disabled?',
34
35
  },
35
- onClick: {
36
- description: 'Event triggered when the component is clicked',
36
+ active: {
37
+ description: 'Is the component active?',
38
+ },
39
+ error: {
40
+ description: 'Is the component error?',
37
41
  },
38
42
  },
39
43
  parameters: figmaPrimaryDesign,
@@ -45,12 +49,11 @@ export const Option = {
45
49
  render: () => (
46
50
  <CardMenuOption
47
51
  id="first-menu-option"
52
+ href="#"
48
53
  icon="Info"
49
54
  variant="primary"
50
55
  title="It's dangerous to go alone!"
51
56
  description="Take this 🗡️ and this 🛡️ and this 💣 and this 🏹 and this 🔪 and this 🐴 and this 🔫 and this 🔪"
52
- isDisabled={false}
53
- onClick={() => alert('click')}
54
57
  />
55
58
  ),
56
59
  }
@@ -59,6 +62,7 @@ export const DisabledOption = {
59
62
  render: () => (
60
63
  <CardMenuOption
61
64
  id="first-menu-option"
65
+ href="#"
62
66
  icon="Info"
63
67
  variant="primary"
64
68
  title="It's dangerous to go alone!"
@@ -68,35 +72,60 @@ export const DisabledOption = {
68
72
  ),
69
73
  }
70
74
 
75
+ export const ActiveOption = {
76
+ render: () => (
77
+ <CardMenuOption
78
+ id="first-menu-option"
79
+ href="#"
80
+ icon="Info"
81
+ variant="primary"
82
+ title="It's dangerous to go alone!"
83
+ description="Take this 🗡️"
84
+ active
85
+ />
86
+ ),
87
+ }
88
+
89
+ export const ErrorOption = {
90
+ render: () => (
91
+ <CardMenuOption
92
+ id="first-menu-option"
93
+ href="#"
94
+ icon="Info"
95
+ variant="primary"
96
+ title="It's dangerous to go alone!"
97
+ description="Take this 🗡️"
98
+ error
99
+ />
100
+ ),
101
+ }
102
+
71
103
  export const Menu = {
72
104
  render: () => (
73
105
  <CardMenu>
74
106
  <CardMenuOption
75
107
  id="first-menu-option"
108
+ href="#"
76
109
  icon="AddCircle"
77
110
  variant="primary"
78
111
  title="Title"
79
112
  description="Name of the videogame"
80
- isDisabled={false}
81
- onClick={() => alert('click title')}
82
113
  />
83
114
  <CardMenuOption
84
115
  id="second-menu-option"
116
+ href="#"
85
117
  icon="Edit"
86
118
  variant="primary"
87
119
  title="Address"
88
120
  description="Videogame company address"
89
- isDisabled={false}
90
- onClick={() => alert('click address')}
91
121
  />
92
122
  <CardMenuOption
93
123
  id="third-menu-option"
124
+ href="#"
94
125
  icon="Info"
95
126
  variant="primary"
96
127
  title="Email"
97
128
  description="Videogame company email"
98
- isDisabled={false}
99
- onClick={() => alert('click email')}
100
129
  />
101
130
  </CardMenu>
102
131
  ),
@@ -3,6 +3,11 @@ import { Meta } from "@storybook/addon-docs";
3
3
  <Meta title="Changelog" />
4
4
  # Changelog
5
5
 
6
+
7
+ ## 0.16.2
8
+ - Add link to CardMenuOption component
9
+ - Add active and error state to CardMenuOption component
10
+
6
11
  ## 0.16.1
7
12
  - Updated Oultined Button background color
8
13
  - Added new icons
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { screen, render } from '@testing-library/react'
2
+ import { render } from '@testing-library/react'
3
3
  import { CardMenuOption } from '@/atoms/CardMenu/CardMenuOption'
4
4
 
5
5
  describe('CardMenuOption', () => {
@@ -7,6 +7,7 @@ describe('CardMenuOption', () => {
7
7
  const { getByRole, getByText, getAllByRole } = render(
8
8
  <CardMenuOption
9
9
  id="option-one"
10
+ href="#"
10
11
  icon="Info"
11
12
  title="It's dangerous to go alone!"
12
13
  description="Take this sword!"