@pareto-engineering/design-system 2.0.0-alpha.3 → 2.0.0-alpha.7

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.
Files changed (34) hide show
  1. package/dist/cjs/a/OvalIllustration/OvalIllustration.js +102 -0
  2. package/dist/cjs/a/OvalIllustration/index.js +15 -0
  3. package/dist/cjs/a/OvalIllustration/styles.scss +105 -0
  4. package/dist/cjs/a/Shapes/Shapes.js +31 -9
  5. package/dist/cjs/a/Shapes/styles.scss +40 -17
  6. package/dist/cjs/a/index.js +17 -1
  7. package/dist/cjs/b/Button/styles.scss +38 -19
  8. package/dist/cjs/b/Page/common/Section/Section.js +42 -5
  9. package/dist/cjs/b/Page/styles.scss +8 -2
  10. package/dist/es/a/OvalIllustration/OvalIllustration.js +86 -0
  11. package/dist/es/a/OvalIllustration/index.js +2 -0
  12. package/dist/es/a/OvalIllustration/styles.scss +105 -0
  13. package/dist/es/a/Shapes/Shapes.js +31 -9
  14. package/dist/es/a/Shapes/styles.scss +40 -17
  15. package/dist/es/a/index.js +3 -1
  16. package/dist/es/b/Button/styles.scss +38 -19
  17. package/dist/es/b/Page/common/Section/Section.js +41 -4
  18. package/dist/es/b/Page/styles.scss +8 -2
  19. package/package.json +1 -1
  20. package/src/__snapshots__/Storyshots.test.js.snap +1480 -336
  21. package/src/stories/a/OvalIllustration.stories.jsx +36 -0
  22. package/src/stories/a/Shapes.stories.jsx +125 -0
  23. package/src/stories/b/Button.stories.jsx +57 -82
  24. package/src/stories/b/Page.stories.jsx +27 -1
  25. package/src/ui/a/OvalIllustration/OvalIllustration.jsx +108 -0
  26. package/src/ui/a/OvalIllustration/index.js +2 -0
  27. package/src/ui/a/OvalIllustration/styles.scss +105 -0
  28. package/src/ui/a/Shapes/Shapes.jsx +181 -0
  29. package/src/ui/a/Shapes/index.js +2 -0
  30. package/src/ui/a/Shapes/styles.scss +222 -0
  31. package/src/ui/a/index.js +2 -0
  32. package/src/ui/b/Button/styles.scss +38 -19
  33. package/src/ui/b/Page/common/Section/Section.jsx +51 -2
  34. package/src/ui/b/Page/styles.scss +8 -2
@@ -0,0 +1,36 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { OvalIllustration } from 'ui'
5
+
6
+ export default {
7
+ title :'a/OvalIllustration',
8
+ component :OvalIllustration,
9
+ subcomponents:{
10
+ // Item:OvalIllustration.Item
11
+ },
12
+ decorators:[
13
+ // storyfn => <div className="">{ storyfn() }</div>,
14
+ ],
15
+ argTypes:{
16
+ backgroundColor:{ control: 'color' },
17
+ },
18
+ }
19
+
20
+ export const WithBackground = () => (
21
+ <OvalIllustration
22
+ backgroundColor="background3"
23
+ src="https://www.azernews.az/media/pictures/company_picture.jpg"
24
+ alt="illustration"
25
+ ovalBackground
26
+ layout="right"
27
+ />
28
+ )
29
+
30
+ export const WithoutBackground = () => (
31
+ <OvalIllustration
32
+ src="https://www.azernews.az/media/pictures/company_picture.jpg"
33
+ alt="illustration"
34
+ layout="left"
35
+ />
36
+ )
@@ -0,0 +1,125 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { Shapes } from 'ui'
5
+
6
+ export default {
7
+ title :'a/Shapes',
8
+ component :Shapes,
9
+ subcomponents:{
10
+ // Item:Shapes.Item
11
+ },
12
+ decorators:[
13
+ // storyfn => <div className="">{ storyfn() }</div>,
14
+ ],
15
+ argTypes:{
16
+ verticalAlign :{ control: 'select' },
17
+ horizontalAlign:{ control: 'select' },
18
+ shape :{ control: 'select' },
19
+ height :{ control: 'text' },
20
+ color :{ control: 'text' },
21
+ },
22
+ }
23
+
24
+ // eslint-disable-next-line react/prop-types
25
+ const Template = ({ color, ...rest }) => (
26
+ <div
27
+ className={`y-${color} b-light-y`}
28
+ style={{
29
+ height:'1000px', position:'relative', overflow:'hidden',
30
+ }}
31
+ >
32
+ <Shapes {...rest} />
33
+ </div>
34
+ )
35
+
36
+ export const Triangle = Template.bind({})
37
+ Triangle.args = {
38
+ height :'30em',
39
+ verticalAlign :'flex-end',
40
+ horizontalAlign:'center',
41
+ color :'background6',
42
+ shape :'triangle',
43
+ }
44
+
45
+ export const HalfEllipses = Template.bind({})
46
+ HalfEllipses.args = {
47
+ height :'25em',
48
+ verticalAlign:'flex-end',
49
+ color :'background3',
50
+ shape :'half-ellipses',
51
+ }
52
+
53
+ export const Ellipse = Template.bind({})
54
+ Ellipse.args = {
55
+ height :'30em',
56
+ verticalAlign:'flex-end',
57
+ color :'main3',
58
+ shape :'ellipse',
59
+ }
60
+
61
+ export const HalfEllipse = Template.bind({})
62
+ HalfEllipse.args = {
63
+ height :'25em',
64
+ verticalAlign:'flex-end',
65
+ color :'background3',
66
+ shape :'half-ellipse',
67
+ }
68
+
69
+ export const Diamonds = Template.bind({})
70
+ Diamonds.args = {
71
+ height :'30em',
72
+ verticalAlign:'flex-end',
73
+ color :'background4',
74
+ shape :'diamonds',
75
+ }
76
+
77
+ export const Rectangles = Template.bind({})
78
+ Rectangles.args = {
79
+ height :'30em',
80
+ verticalAlign:'flex-end',
81
+ color :'background5',
82
+ shape :'rectangles',
83
+ }
84
+
85
+ export const Circle = Template.bind({})
86
+ Circle.args = {
87
+ height :'30em',
88
+ verticalAlign:'flex-end',
89
+ color :'background5',
90
+ shape :'circle',
91
+ }
92
+
93
+ export const HalfCircle = Template.bind({})
94
+ HalfCircle.args = {
95
+ height :'30em',
96
+ verticalAlign:'flex-end',
97
+ color :'background4',
98
+ shape :'half-circle',
99
+ }
100
+
101
+ export const Ellipses = Template.bind({})
102
+ Ellipses.args = {
103
+ height :'30em',
104
+ verticalAlign:'flex-end',
105
+ color :'background4',
106
+ shape :'ellipses',
107
+ }
108
+
109
+ export const Spiral = Template.bind({})
110
+ Spiral.args = {
111
+ height :'100em',
112
+ verticalAlign :'center',
113
+ horizontalAlign:'center',
114
+ color :'background6',
115
+ shape :'spiral',
116
+ }
117
+
118
+ export const RotatedEllipses = Template.bind({})
119
+ RotatedEllipses.args = {
120
+ height :'60em',
121
+ verticalAlign :'center',
122
+ horizontalAlign:'center',
123
+ color :'background5',
124
+ shape :'rotated-ellipses',
125
+ }
@@ -14,96 +14,71 @@ export default {
14
14
  // storyfn => <div className="">{ storyfn() }</div>,
15
15
  ],
16
16
  argTypes:{
17
- isGhost :{ control: 'boolean' },
18
- disabled:{ control: 'boolean' },
17
+ color :{ control: { type: 'select', options: ALL_COLORS } },
18
+ disabled:{ control: { type: 'boolean' } },
19
+ isGhost :{ control: { type: 'boolean' } },
20
+ isSimple:{ control: { type: 'boolean' } },
19
21
  },
20
22
  }
21
23
 
22
- export const Base = (props) => <Button {...props}>Sample Button</Button>
24
+ const SingleTemplate = (args) => <Button {...args} />
23
25
 
24
- export const Ghost = (props) => (
25
- <Button isGhost {...props}>
26
- Sample Button
26
+ export const Base = SingleTemplate.bind({})
27
+ Base.args = {
28
+ children:'Sample Button',
29
+ }
30
+
31
+ export const Ghost = SingleTemplate.bind({})
32
+ Ghost.args = {
33
+ isGhost :true,
34
+ children:'Sample Button',
35
+ }
36
+
37
+ const MultipleTemplate = (args) => ALL_COLORS.map((colorName) => (
38
+ <Button {...args} color={colorName} key={colorName}>
39
+ This is a
40
+ {' '}
41
+ {colorName}
42
+ {' '}
43
+ button
27
44
  </Button>
28
- )
45
+ ))
29
46
 
30
- export const Simple = (props) => (
31
- <>
32
- {ALL_COLORS.map((colorName) => (
33
- <Button {...props} color={colorName} key={colorName} isSimple>
34
- This is a
35
- {' '}
36
- {colorName}
37
- {' '}
38
- button
39
- </Button>
40
- ))}
41
- </>
42
- )
47
+ export const Normal = MultipleTemplate.bind({})
43
48
 
44
- export const Colors = (props) => (
45
- <>
46
- {ALL_COLORS.map((colorName) => (
47
- <Button {...props} color={colorName} key={colorName}>
48
- This is a
49
- {' '}
50
- {colorName}
51
- {' '}
52
- button
53
- </Button>
54
- ))}
55
- </>
56
- )
49
+ export const Ghosts = MultipleTemplate.bind({})
50
+ Ghosts.args = {
51
+ isGhost:true,
52
+ }
57
53
 
58
- export const GhostColors = (props) => (
59
- <>
60
- {ALL_COLORS.map((colorName) => (
61
- <Button {...props} color={colorName} key={colorName} isGhost>
62
- This is a
63
- {' '}
64
- {colorName}
65
- {' '}
66
- button
67
- </Button>
68
- ))}
69
- </>
70
- )
54
+ export const Simple = MultipleTemplate.bind({})
55
+ Simple.args = {
56
+ isSimple:true,
57
+ }
71
58
 
72
- export const Compact = (props) => (
73
- <>
74
- {ALL_COLORS.map((colorName) => (
75
- <Button {...props} color={colorName} key={colorName} isCompact>
76
- This is a
77
- {' '}
78
- {colorName}
79
- {' '}
80
- </Button>
81
- ))}
82
- </>
83
- )
59
+ export const Compact = MultipleTemplate.bind({})
60
+ Compact.args = {
61
+ isCompact:true,
62
+ }
84
63
 
85
- export const Disabled = (props) => (
86
- <>
87
- {ALL_COLORS.map((colorName) => (
88
- <Button {...props} color={colorName} key={colorName} disabled>
89
- This is a
90
- {' '}
91
- {colorName}
92
- {' '}
93
- </Button>
94
- ))}
95
- </>
96
- )
64
+ export const Disabled = MultipleTemplate.bind({})
65
+ Disabled.args = {
66
+ disabled:true,
67
+ }
68
+
69
+ export const GhostDisabled = MultipleTemplate.bind({})
70
+ GhostDisabled.args = {
71
+ isGhost :true,
72
+ disabled:true,
73
+ }
97
74
 
98
- export const Loading = (props) => (
99
- <>
100
- {ALL_COLORS.map((colorName) => (
101
- <Button {...props} color={colorName} key={colorName} isLoading>
102
- This is a
103
- {' '}
104
- {colorName}
105
- {' '}
106
- </Button>
107
- ))}
108
- </>
109
- )
75
+ export const SimpleDisabled = MultipleTemplate.bind({})
76
+ SimpleDisabled.args = {
77
+ isSimple:true,
78
+ disabled:true,
79
+ }
80
+
81
+ export const Loading = MultipleTemplate.bind({})
82
+ Loading.args = {
83
+ isLoading:true,
84
+ }
@@ -1,7 +1,7 @@
1
1
  /* @pareto-engineering/generator-front 1.0.0 */
2
2
  import * as React from 'react'
3
3
 
4
- import { Page } from 'ui'
4
+ import { Page, Quote } from 'ui'
5
5
 
6
6
  export default {
7
7
  title :'b/Page',
@@ -57,3 +57,29 @@ export const WithSections = () => (
57
57
  </Page.Section>
58
58
  </Page>
59
59
  )
60
+
61
+ export const SectionsWithBackground = () => (
62
+ <Page
63
+ id="with-sections"
64
+ >
65
+ <Page.Section
66
+ id="s1"
67
+ backgroundShape="triangle"
68
+ backgroundHeight="30em"
69
+ backgroundVerticalAlign="flex-end"
70
+ backgroundHorizontalAlign="center"
71
+ className="y-success b-light-y"
72
+ style={{
73
+ height :'30em',
74
+ display :'flex',
75
+ justifyContent:'center',
76
+ alignItems :'center',
77
+ }}
78
+ >
79
+ <Quote author="Austen Spoonts" color="paragraph">
80
+ Pareto was like having a full-time employee without having to hire somebody.
81
+ That’s how I would explain it. An on-call, on-demand full-time employee.
82
+ </Quote>
83
+ </Page.Section>
84
+ </Page>
85
+ )
@@ -0,0 +1,108 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useLayoutEffect } from 'react'
5
+
6
+ import PropTypes from 'prop-types'
7
+
8
+ import styleNames from '@pareto-engineering/bem'
9
+
10
+ // Local Definitions
11
+
12
+ const baseClassName = styleNames.base
13
+
14
+ const componentClassName = 'oval-illustration'
15
+
16
+ /**
17
+ * This is the component description.
18
+ */
19
+ const OvalIllustration = ({
20
+ id,
21
+ className:userClassName,
22
+ style,
23
+ layout,
24
+ src,
25
+ alt,
26
+ ovalBackground,
27
+ backgroundColor,
28
+ // ...otherProps
29
+ }) => {
30
+ useLayoutEffect(() => {
31
+ import('./styles.scss')
32
+ }, [])
33
+
34
+ return (
35
+ <div
36
+ id={id}
37
+ className={[
38
+
39
+ baseClassName,
40
+
41
+ componentClassName,
42
+ userClassName,
43
+ layout,
44
+ ]
45
+ .filter((e) => e)
46
+ .join(' ')}
47
+ style={style}
48
+ // {...otherProps}
49
+ >
50
+ {ovalBackground
51
+ && <div className={`oval-background y-${backgroundColor}`} />}
52
+ <div className="illustration">
53
+ <img src={src} alt={alt} />
54
+ </div>
55
+ </div>
56
+ )
57
+ }
58
+
59
+ OvalIllustration.propTypes = {
60
+ /**
61
+ * The HTML id for this element
62
+ */
63
+ id:PropTypes.string,
64
+
65
+ /**
66
+ * The HTML class names for this element
67
+ */
68
+ className:PropTypes.string,
69
+
70
+ /**
71
+ * The React-written, css properties for this element.
72
+ */
73
+ style:PropTypes.objectOf(PropTypes.string),
74
+
75
+ /**
76
+ * side definition of the illustration
77
+ */
78
+ layout:PropTypes.oneOf([
79
+ 'left',
80
+ 'right',
81
+ ]),
82
+
83
+ /**
84
+ * image url
85
+ */
86
+ src:PropTypes.string,
87
+
88
+ /**
89
+ * alt tag for the image
90
+ */
91
+ alt:PropTypes.string,
92
+
93
+ /**
94
+ * whether to have a oval shape as background
95
+ */
96
+ ovalBackground:PropTypes.bool,
97
+
98
+ /**
99
+ * background color of the oval behind the image
100
+ */
101
+ backgroundColor:PropTypes.string,
102
+ }
103
+
104
+ OvalIllustration.defaultProps = {
105
+ layout:'left',
106
+ }
107
+
108
+ export default OvalIllustration
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as OvalIllustration } from './OvalIllustration'
@@ -0,0 +1,105 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+ @use "@aztlan/stylebook/src/mixins";
5
+ @use "@aztlan/stylebook/src/globals" as *;
6
+
7
+ $default-desktop-shape-size:45em;
8
+ $default-tablet-shape-size:35em;
9
+ $default-mobile-shape-size:20em;
10
+ $default-clockwise-degree:60deg;
11
+ $default-counter-clockwise-degree:-60deg;
12
+ $default-ellipse-size:30% 43% at 50% 50%;
13
+
14
+ .#{bem.$base}.oval-illustration {
15
+ display: flex;
16
+ justify-content: center;
17
+ overflow: hidden;
18
+ position: relative;
19
+
20
+ &.left {
21
+ .oval-background {
22
+ transform: rotate($default-clockwise-degree);
23
+ }
24
+
25
+ .illustration {
26
+ transform: rotate($default-counter-clockwise-degree);
27
+
28
+ > img {
29
+ transform: rotate($default-clockwise-degree);
30
+ }
31
+ }
32
+ }
33
+
34
+ &.right {
35
+ .oval-background {
36
+ transform: rotate($default-counter-clockwise-degree);
37
+ }
38
+
39
+ .illustration {
40
+ transform: rotate($default-clockwise-degree);
41
+
42
+ > img {
43
+ transform: rotate($default-counter-clockwise-degree);
44
+ }
45
+ }
46
+ }
47
+
48
+ .oval-background {
49
+ background: var(--y);
50
+ clip-path: ellipse($default-ellipse-size);
51
+ overflow: hidden;
52
+ position: absolute;
53
+ z-index: -100;
54
+ }
55
+
56
+ .illustration {
57
+ clip-path: ellipse($default-ellipse-size);
58
+ overflow: hidden;
59
+
60
+ > img {
61
+ height: 100%;
62
+ object-fit: cover;
63
+ width: 100%;
64
+ }
65
+ }
66
+
67
+ // mobile style
68
+ @include mixins.media($to:$sm-md) {
69
+ .oval-background {
70
+ height: $default-mobile-shape-size;
71
+ width: $default-mobile-shape-size;
72
+ }
73
+
74
+ .illustration {
75
+ height: $default-mobile-shape-size;
76
+ width: $default-mobile-shape-size;
77
+ }
78
+ }
79
+
80
+ // tablet style
81
+ @include mixins.media($from:$xs-sm, $to:$sm-md) {
82
+ .oval-background {
83
+ height: $default-tablet-shape-size;
84
+ width: $default-tablet-shape-size;
85
+ }
86
+
87
+ .illustration {
88
+ height: $default-tablet-shape-size;
89
+ width: $default-tablet-shape-size;
90
+ }
91
+ }
92
+
93
+ // desktop style
94
+ @include mixins.media($from:$sm-md) {
95
+ .oval-background {
96
+ height: $default-desktop-shape-size;
97
+ width: $default-desktop-shape-size;
98
+ }
99
+
100
+ .illustration {
101
+ height: $default-desktop-shape-size;
102
+ width: $default-desktop-shape-size;
103
+ }
104
+ }
105
+ }