imbric-theme 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/.babelrc.json +3 -0
  2. package/.commitlintrc.json +3 -0
  3. package/.editorconfig +13 -0
  4. package/.eslintcache +1 -0
  5. package/.eslintrc.json +36 -0
  6. package/.huskyrc.json +6 -0
  7. package/.lintstagedrc.json +5 -0
  8. package/.nvmrc +1 -0
  9. package/.prettierrc.json +4 -0
  10. package/.releaserc.json +13 -0
  11. package/.storybook/main.js +9 -0
  12. package/.storybook/preview-head.html +2 -0
  13. package/.storybook/preview.js +32 -0
  14. package/.stylelintrc.json +14 -0
  15. package/.vscode/launch.json +15 -0
  16. package/CHANGELOG.md +0 -0
  17. package/README.md +69 -0
  18. package/atoms/Avatar/Avatar.js +36 -0
  19. package/atoms/Avatar/Avatar.module.css +3 -0
  20. package/atoms/Avatar/Avatar.stories.js +29 -0
  21. package/atoms/Avatar/__snapshots__/Avatar.stories.js.snap +105 -0
  22. package/atoms/Avatar/constants.js +3 -0
  23. package/atoms/Avatar/helpers.js +7 -0
  24. package/atoms/Avatar/index.js +3 -0
  25. package/atoms/Button/Button.js +68 -0
  26. package/atoms/Button/Button.module.css +63 -0
  27. package/atoms/Button/Button.stories.js +47 -0
  28. package/atoms/Button/Button.test.js +60 -0
  29. package/atoms/Button/__snapshots__/Button.stories.js.snap +191 -0
  30. package/atoms/Button/constants.js +3 -0
  31. package/atoms/Button/index.js +3 -0
  32. package/atoms/Card/Card.js +48 -0
  33. package/atoms/Card/Card.module.css +52 -0
  34. package/atoms/Card/Card.stories.js +41 -0
  35. package/atoms/Card/__snapshots__/Card.stories.js.snap +136 -0
  36. package/atoms/Card/constants.js +4 -0
  37. package/atoms/Card/index.js +3 -0
  38. package/atoms/Check/Check.js +26 -0
  39. package/atoms/Check/Check.module.css +11 -0
  40. package/atoms/Check/Check.stories.js +15 -0
  41. package/atoms/Check/__snapshots__/Check.stories.js.snap +67 -0
  42. package/atoms/Check/index.js +2 -0
  43. package/atoms/Divider/Divider.js +19 -0
  44. package/atoms/Divider/Divider.module.css +5 -0
  45. package/atoms/Divider/Divider.stories.js +12 -0
  46. package/atoms/Divider/__snapshots__/Divider.stories.js.snap +22 -0
  47. package/atoms/Divider/index.js +2 -0
  48. package/atoms/Heading/Heading.js +37 -0
  49. package/atoms/Heading/Heading.module.css +66 -0
  50. package/atoms/Heading/Heading.stories.js +46 -0
  51. package/atoms/Heading/__snapshots__/Heading.stories.js.snap +189 -0
  52. package/atoms/Heading/constants.js +5 -0
  53. package/atoms/Heading/index.js +3 -0
  54. package/atoms/Icon/Icon.js +66 -0
  55. package/atoms/Icon/Icon.module.css +112 -0
  56. package/atoms/Icon/Icon.stories.js +48 -0
  57. package/atoms/Icon/__snapshots__/Icon.stories.js.snap +1311 -0
  58. package/atoms/Icon/constants.js +486 -0
  59. package/atoms/Icon/helpers.js +9 -0
  60. package/atoms/Icon/index.js +3 -0
  61. package/atoms/Input/Input.js +49 -0
  62. package/atoms/Input/Input.module.css +27 -0
  63. package/atoms/Input/Input.stories.js +32 -0
  64. package/atoms/Input/__snapshots__/Input.stories.js.snap +101 -0
  65. package/atoms/Input/constants.js +3 -0
  66. package/atoms/Input/index.js +3 -0
  67. package/atoms/Link/Link.js +33 -0
  68. package/atoms/Link/Link.module.css +14 -0
  69. package/atoms/Link/Link.stories.js +30 -0
  70. package/atoms/Link/__snapshots__/Link.stories.js.snap +118 -0
  71. package/atoms/Link/constants.js +5 -0
  72. package/atoms/Link/index.js +3 -0
  73. package/atoms/Loading/Loading.js +30 -0
  74. package/atoms/Loading/Loading.module.css +51 -0
  75. package/atoms/Loading/Loading.stories.js +17 -0
  76. package/atoms/Loading/__snapshots__/Loading.stories.js.snap +26 -0
  77. package/atoms/Loading/index.js +2 -0
  78. package/atoms/Modal/Modal.js +98 -0
  79. package/atoms/Modal/Modal.module.css +85 -0
  80. package/atoms/Modal/Modal.stories.js +43 -0
  81. package/atoms/Modal/__snapshots__/Modal.stories.js.snap +239 -0
  82. package/atoms/Modal/constants.js +1 -0
  83. package/atoms/Modal/index.js +3 -0
  84. package/atoms/Paragraph/Paragraph.js +56 -0
  85. package/atoms/Paragraph/Paragraph.module.css +68 -0
  86. package/atoms/Paragraph/Paragraph.stories.js +52 -0
  87. package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +230 -0
  88. package/atoms/Paragraph/constants.js +5 -0
  89. package/atoms/Paragraph/index.js +3 -0
  90. package/atoms/Picture/Picture.js +40 -0
  91. package/atoms/Picture/Picture.module.css +16 -0
  92. package/atoms/Picture/Picture.stories.js +32 -0
  93. package/atoms/Picture/__snapshots__/Picture.stories.js.snap +156 -0
  94. package/atoms/Picture/index.js +2 -0
  95. package/atoms/Textarea/Textarea.js +46 -0
  96. package/atoms/Textarea/Textarea.module.css +25 -0
  97. package/atoms/Textarea/Textarea.stories.js +16 -0
  98. package/atoms/Textarea/__snapshots__/Textarea.stories.js.snap +25 -0
  99. package/atoms/Textarea/index.js +2 -0
  100. package/codecov.yml +2 -0
  101. package/helpers/storybook.js +29 -0
  102. package/helpers/storybook.test.js +40 -0
  103. package/helpers/styles.js +37 -0
  104. package/helpers/styles.test.js +222 -0
  105. package/hocs/withStyles.js +17 -0
  106. package/hook/useMedia.js +22 -0
  107. package/index.js +31 -0
  108. package/jest.config.js +23 -0
  109. package/jest.setup.js +13 -0
  110. package/layout/CenteredContent/CenteredContent.js +30 -0
  111. package/layout/CenteredContent/CenteredContent.module.css +12 -0
  112. package/layout/CenteredContent/CenteredContent.stories.js +22 -0
  113. package/layout/CenteredContent/__snapshots__/CenteredContent.stories.js.snap +27 -0
  114. package/layout/CenteredContent/index.js +2 -0
  115. package/layout/Container/Container.js +29 -0
  116. package/layout/Container/Container.module.css +14 -0
  117. package/layout/Container/Container.stories.js +22 -0
  118. package/layout/Container/__snapshots__/Container.stories.js.snap +27 -0
  119. package/layout/Container/index.js +2 -0
  120. package/layout/FullHeightContent/FullHeightContent.js +40 -0
  121. package/layout/FullHeightContent/FullHeightContent.module.css +21 -0
  122. package/layout/FullHeightContent/FullHeightContent.stories.js +22 -0
  123. package/layout/FullHeightContent/__snapshots__/FullHeightContent.stories.js.snap +41 -0
  124. package/layout/FullHeightContent/index.js +2 -0
  125. package/layout/Spacer/Spacer.js +40 -0
  126. package/layout/Spacer/Spacer.module.css +12 -0
  127. package/layout/Spacer/Spacer.stories.js +25 -0
  128. package/layout/Spacer/__snapshots__/Spacer.stories.js.snap +97 -0
  129. package/layout/Spacer/components/Horizontal/Horizontal.js +43 -0
  130. package/layout/Spacer/components/Horizontal/Horizontal.stories.js +32 -0
  131. package/layout/Spacer/components/Horizontal/__snapshots__/Horizontal.stories.js.snap +97 -0
  132. package/layout/Spacer/components/Horizontal/index.js +1 -0
  133. package/layout/Spacer/components/Vertical/Vertical.js +31 -0
  134. package/layout/Spacer/components/Vertical/Vertical.stories.js +25 -0
  135. package/layout/Spacer/components/Vertical/__snapshots__/Vertical.stories.js.snap +85 -0
  136. package/layout/Spacer/components/Vertical/index.js +1 -0
  137. package/layout/Spacer/components/index.js +2 -0
  138. package/layout/Spacer/constants.js +5 -0
  139. package/layout/Spacer/helpers.js +3 -0
  140. package/layout/Spacer/index.js +3 -0
  141. package/molecules/Accordion/Accordion.js +70 -0
  142. package/molecules/Accordion/Accordion.module.css +12 -0
  143. package/molecules/Accordion/Accordion.stories.js +31 -0
  144. package/molecules/Accordion/__snapshots__/Accordion.stories.js.snap +228 -0
  145. package/molecules/Accordion/index.js +2 -0
  146. package/molecules/AddButton/AddButton.js +137 -0
  147. package/molecules/AddButton/AddButton.module.css +128 -0
  148. package/molecules/AddButton/AddButton.stories.js +47 -0
  149. package/molecules/AddButton/__snapshots__/AddButton.stories.js.snap +326 -0
  150. package/molecules/AddButton/constants.js +6 -0
  151. package/molecules/AddButton/handlers.js +58 -0
  152. package/molecules/AddButton/handlers.test.js +19 -0
  153. package/molecules/AddButton/helpers.js +6 -0
  154. package/molecules/AddButton/helpers.test.js +41 -0
  155. package/molecules/AddButton/hooks.js +14 -0
  156. package/molecules/AddButton/index.js +3 -0
  157. package/molecules/ButtonIcon/ButtonIcon.js +41 -0
  158. package/molecules/ButtonIcon/ButtonIcon.stories.js +27 -0
  159. package/molecules/ButtonIcon/__snapshots__/ButtonIcon.stories.js.snap +178 -0
  160. package/molecules/ButtonIcon/constants.js +6 -0
  161. package/molecules/ButtonIcon/index.js +2 -0
  162. package/molecules/Dropdown/Dropdown.js +59 -0
  163. package/molecules/Dropdown/Dropdown.module.css +34 -0
  164. package/molecules/Dropdown/Dropdown.stories.js +41 -0
  165. package/molecules/Dropdown/__snapshots__/Dropdown.stories.js.snap +181 -0
  166. package/molecules/Dropdown/index.js +2 -0
  167. package/molecules/Error/Error.js +35 -0
  168. package/molecules/Error/Error.module.css +11 -0
  169. package/molecules/Error/Error.stories.js +18 -0
  170. package/molecules/Error/__snapshots__/Error.stories.js.snap +134 -0
  171. package/molecules/Error/index.js +2 -0
  172. package/molecules/IconLabel/IconLabel.js +83 -0
  173. package/molecules/IconLabel/IconLabel.module.css +16 -0
  174. package/molecules/IconLabel/IconLabel.stories.js +25 -0
  175. package/molecules/IconLabel/__snapshots__/IconLabel.stories.js.snap +211 -0
  176. package/molecules/IconLabel/constants.js +6 -0
  177. package/molecules/IconLabel/index.js +3 -0
  178. package/molecules/LoadingError/LoadingError.js +31 -0
  179. package/molecules/LoadingError/LoadingError.stories.js +24 -0
  180. package/molecules/LoadingError/__snapshots__/LoadingError.stories.js.snap +109 -0
  181. package/molecules/LoadingError/index.js +1 -0
  182. package/molecules/Score/Score.js +61 -0
  183. package/molecules/Score/Score.module.css +11 -0
  184. package/molecules/Score/Score.stories.js +13 -0
  185. package/molecules/Score/__snapshots__/Score.stories.js.snap +100 -0
  186. package/molecules/Score/faces/happy.svg +7 -0
  187. package/molecules/Score/faces/normal.svg +6 -0
  188. package/molecules/Score/faces/sad.svg +6 -0
  189. package/molecules/Score/index.js +2 -0
  190. package/molecules/Task/Task.js +114 -0
  191. package/molecules/Task/Task.module.css +47 -0
  192. package/molecules/Task/Task.stories.js +47 -0
  193. package/molecules/Task/__snapshots__/Task.stories.js.snap +953 -0
  194. package/molecules/Task/constants.js +1 -0
  195. package/molecules/Task/index.js +3 -0
  196. package/molecules/TaskCounter/TaskCounter.js +74 -0
  197. package/molecules/TaskCounter/TaskCounter.module.css +11 -0
  198. package/molecules/TaskCounter/TaskCounter.stories.js +26 -0
  199. package/molecules/TaskCounter/__snapshots__/TaskCounter.stories.js.snap +177 -0
  200. package/molecules/TaskCounter/index.js +2 -0
  201. package/package.json +102 -0
  202. package/scripts/build-tokens.js +40 -0
  203. package/scripts/create-component.js +127 -0
  204. package/storybook.test.js +13 -0
  205. package/styles/globals.css +10 -0
  206. package/styles/tokens.css +390 -0
  207. package/templates/component/Component.js +22 -0
  208. package/templates/component/Component.module.css +3 -0
  209. package/templates/component/Component.stories.js +23 -0
  210. package/templates/component/constants.js +1 -0
  211. package/templates/component/index.js +3 -0
  212. package/tokens/Token/Helper.js +30 -0
  213. package/tokens/Token/Token.js +13 -0
  214. package/tokens/Token/Token.module.css +64 -0
  215. package/tokens/Token/components/Color.js +21 -0
  216. package/tokens/Token/components/Color.stories.js +126 -0
  217. package/tokens/Token/components/FontFamily.js +24 -0
  218. package/tokens/Token/components/FontFamily.stories.js +32 -0
  219. package/tokens/Token/components/FontSize.js +24 -0
  220. package/tokens/Token/components/FontSize.stories.js +31 -0
  221. package/tokens/Token/components/FontWeight.js +24 -0
  222. package/tokens/Token/components/FontWeight.stories.js +31 -0
  223. package/tokens/Token/components/Spacing.js +24 -0
  224. package/tokens/Token/components/Spacing.stories.js +29 -0
  225. package/tokens/Token/components/__snapshots__/Color.stories.js.snap +7169 -0
  226. package/tokens/Token/components/__snapshots__/FontFamily.stories.js.snap +133 -0
  227. package/tokens/Token/components/__snapshots__/FontSize.stories.js.snap +261 -0
  228. package/tokens/Token/components/__snapshots__/FontWeight.stories.js.snap +317 -0
  229. package/tokens/Token/components/__snapshots__/Spacing.stories.js.snap +229 -0
  230. package/tokens/Token/components/index.js +5 -0
  231. package/tokens/Token/helpers.js +17 -0
  232. package/tokens/Token/index.js +1 -0
  233. package/tokens/index.js +471 -0
  234. package/utils/isEmpty.js +28 -0
  235. package/utils/isEmpty.test.js +125 -0
  236. package/utils/isObject.js +4 -0
  237. package/utils/keyboardCodes.js +6 -0
  238. package/utils/testUtils/matchMediaMock.js +14 -0
  239. package/utils/testUtils/svgrMock.js +2 -0
  240. package/utils/toCapitalize.js +4 -0
  241. package/utils/toKebabCase.js +8 -0
  242. package/utils/toPascalCase.js +20 -0
  243. package/webpack/cssModules.js +30 -0
  244. package/webpack/loadConfigs.js +6 -0
  245. package/webpack/reactInlineSvg.js +22 -0
@@ -0,0 +1,109 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storyshots Molecules/LoadingError Default 1`] = `
4
+ <div
5
+ style={
6
+ Object {
7
+ "alignContent": "flex-start",
8
+ "display": "flex",
9
+ "flexDirection": "column",
10
+ "flexWrap": "wrap",
11
+ "gap": "10px 30px",
12
+ "height": "100%",
13
+ "justifyContent": "flex-start",
14
+ "maxHeight": "auto",
15
+ }
16
+ }
17
+ >
18
+ Exile ruins brook Angmar inn wars retaken. Swiftly attacks Grma merely! Opinion Eorlingas inquisitive windlance? You are full of surprises, Master Baggins. Houses warning garden noble innocent silver charm numerous thirsty came Treebeard's warm.
19
+ </div>
20
+ `;
21
+
22
+ exports[`Storyshots Molecules/LoadingError Error 1`] = `
23
+ <div
24
+ style={
25
+ Object {
26
+ "alignContent": "flex-start",
27
+ "display": "flex",
28
+ "flexDirection": "column",
29
+ "flexWrap": "wrap",
30
+ "gap": "10px 30px",
31
+ "height": "100%",
32
+ "justifyContent": "flex-start",
33
+ "maxHeight": "auto",
34
+ }
35
+ }
36
+ >
37
+ <div
38
+ className="error"
39
+ >
40
+ <div
41
+ className="icon-warning icon color-base size-md background-transparent"
42
+ style={
43
+ Object {
44
+ "height": 35,
45
+ "width": 35,
46
+ }
47
+ }
48
+ >
49
+ <svg
50
+ height={35}
51
+ viewBox="0 0 20 20"
52
+ width={35}
53
+ xmlns="http://www.w3.org/2000/svg"
54
+ >
55
+ <path
56
+ clipRule="evenodd"
57
+ d="M10 20C4.48612 20 0 15.5139 0 10C0 4.48612 4.48612 0 10 0C15.5139 0 20 4.48612 20 10C20 15.5139 15.5139 20 10 20ZM10 1.09864C5.09155 1.09864 1.09864 5.09155 1.09864 10C1.09864 14.9084 5.09155 18.9014 10 18.9014C14.9084 18.9014 18.9014 14.9084 18.9014 10C18.9014 5.09155 14.9084 1.09864 10 1.09864Z"
58
+ fillRule="evenodd"
59
+ />
60
+ <path
61
+ d="M10.7837 11.8579H9.25293L9.08447 4.33594H10.9595L10.7837 11.8579ZM9.0332 14.1577C9.0332 13.8794 9.12354 13.6499 9.3042 13.4692C9.48486 13.2837 9.73145 13.1909 10.0439 13.1909C10.3564 13.1909 10.603 13.2837 10.7837 13.4692C10.9644 13.6499 11.0547 13.8794 11.0547 14.1577C11.0547 14.4263 10.9668 14.6509 10.791 14.8315C10.6152 15.0122 10.3662 15.1025 10.0439 15.1025C9.72168 15.1025 9.47266 15.0122 9.29688 14.8315C9.12109 14.6509 9.0332 14.4263 9.0332 14.1577Z"
62
+ />
63
+ </svg>
64
+ </div>
65
+ <div
66
+ className="spacer horizontal"
67
+ style={
68
+ Object {
69
+ "height": "100%",
70
+ "maxHeight": "auto",
71
+ "width": 15,
72
+ }
73
+ }
74
+ />
75
+ <div>
76
+ <p
77
+ className="paragraph color-base size-md weight-normal"
78
+ >
79
+ ext Grimbold sneak-thief cheekbones myth overfond task
80
+ </p>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ `;
85
+
86
+ exports[`Storyshots Molecules/LoadingError Loading 1`] = `
87
+ <div
88
+ style={
89
+ Object {
90
+ "alignContent": "flex-start",
91
+ "display": "flex",
92
+ "flexDirection": "column",
93
+ "flexWrap": "wrap",
94
+ "gap": "10px 30px",
95
+ "height": "100%",
96
+ "justifyContent": "flex-start",
97
+ "maxHeight": "auto",
98
+ }
99
+ }
100
+ >
101
+ <div
102
+ className="container"
103
+ >
104
+ <div
105
+ className="loading is-shown"
106
+ />
107
+ </div>
108
+ </div>
109
+ `;
@@ -0,0 +1 @@
1
+ export { default, LoadingError } from './LoadingError'
@@ -0,0 +1,61 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import styles from './Score.module.css'
5
+ import withStyles from '../../hocs/withStyles'
6
+
7
+ import Spacer from '../../layout/Spacer'
8
+ import Paragraph from '../../atoms/Paragraph'
9
+
10
+ import SadFace from './faces/sad.svg'
11
+ import NormalFace from './faces/normal.svg'
12
+ import HappyFace from './faces/happy.svg'
13
+
14
+ const handleClickScore = ({ score, onClickScore }) => () => {
15
+ onClickScore({ score })
16
+ }
17
+
18
+ export const Score = ({ getStyles, onClickScore }) => {
19
+ return (
20
+ <div className={getStyles('score')}>
21
+ <div
22
+ className={getStyles('face')}
23
+ onClick={handleClickScore({ score: 0, onClickScore })}
24
+ >
25
+ <SadFace />
26
+ <Spacer.Vertical size="xs" />
27
+ <Paragraph>Frustrado</Paragraph>
28
+ </div>
29
+ <Spacer.Horizontal size="lg" />
30
+ <div
31
+ className={getStyles('face')}
32
+ onClick={handleClickScore({ score: 2.5, onClickScore })}
33
+ >
34
+ <NormalFace />
35
+ <Spacer.Vertical size="xs" />
36
+ <Paragraph>Normal</Paragraph>
37
+ </div>
38
+ <Spacer.Horizontal size="lg" />
39
+ <div
40
+ className={getStyles('face')}
41
+ onClick={handleClickScore({ score: 5, onClickScore })}
42
+ >
43
+ <HappyFace />
44
+ <Spacer.Vertical size="xs" />
45
+ <Paragraph>Muy motivado</Paragraph>
46
+ </div>
47
+ </div>
48
+ )
49
+ }
50
+
51
+ Score.propTypes = {
52
+ getStyles: PropTypes.func.isRequired,
53
+ onClickScore: PropTypes.func.isRequired,
54
+ }
55
+
56
+ Score.defaultProps = {
57
+ getStyles: () => {},
58
+ onClickScore: () => {},
59
+ }
60
+
61
+ export default withStyles(styles)(Score)
@@ -0,0 +1,11 @@
1
+ .score {
2
+ display: flex;
3
+ justify-content: center;
4
+ }
5
+
6
+ .face {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ cursor: pointer;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { Score, styles } from '.'
2
+
3
+ import { getTemplate } from '../../helpers/storybook'
4
+
5
+ const Template = getTemplate(Score, styles)
6
+
7
+ export default {
8
+ title: 'Molecules/Score',
9
+ component: Score,
10
+ args: {},
11
+ }
12
+
13
+ export const Default = Template.bind({})
@@ -0,0 +1,100 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storyshots Molecules/Score Default 1`] = `
4
+ <div
5
+ style={
6
+ Object {
7
+ "alignContent": "flex-start",
8
+ "display": "flex",
9
+ "flexDirection": "column",
10
+ "flexWrap": "wrap",
11
+ "gap": "10px 30px",
12
+ "height": "100%",
13
+ "justifyContent": "flex-start",
14
+ "maxHeight": "auto",
15
+ }
16
+ }
17
+ >
18
+ <div
19
+ className="score"
20
+ >
21
+ <div
22
+ className="face"
23
+ onClick={[Function]}
24
+ >
25
+ <SvgrURL />
26
+ <div
27
+ className="spacer vertical"
28
+ style={
29
+ Object {
30
+ "height": 5,
31
+ }
32
+ }
33
+ />
34
+ <p
35
+ className="paragraph color-base size-md weight-normal"
36
+ >
37
+ Frustrado
38
+ </p>
39
+ </div>
40
+ <div
41
+ className="spacer horizontal"
42
+ style={
43
+ Object {
44
+ "height": "100%",
45
+ "maxHeight": "auto",
46
+ "width": 40,
47
+ }
48
+ }
49
+ />
50
+ <div
51
+ className="face"
52
+ onClick={[Function]}
53
+ >
54
+ <SvgrURL />
55
+ <div
56
+ className="spacer vertical"
57
+ style={
58
+ Object {
59
+ "height": 5,
60
+ }
61
+ }
62
+ />
63
+ <p
64
+ className="paragraph color-base size-md weight-normal"
65
+ >
66
+ Normal
67
+ </p>
68
+ </div>
69
+ <div
70
+ className="spacer horizontal"
71
+ style={
72
+ Object {
73
+ "height": "100%",
74
+ "maxHeight": "auto",
75
+ "width": 40,
76
+ }
77
+ }
78
+ />
79
+ <div
80
+ className="face"
81
+ onClick={[Function]}
82
+ >
83
+ <SvgrURL />
84
+ <div
85
+ className="spacer vertical"
86
+ style={
87
+ Object {
88
+ "height": 5,
89
+ }
90
+ }
91
+ />
92
+ <p
93
+ className="paragraph color-base size-md weight-normal"
94
+ >
95
+ Muy motivado
96
+ </p>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ `;
@@ -0,0 +1,7 @@
1
+ <svg width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18.5215 36.7731C28.7237 36.7731 36.9942 28.5789 36.9942 18.4709C36.9942 8.36288 28.7237 0.168701 18.5215 0.168701C8.31941 0.168701 0.0489502 8.36288 0.0489502 18.4709C0.0489502 28.5789 8.31941 36.7731 18.5215 36.7731Z" fill="#F9DF70"/>
3
+ <path d="M25.4679 12.0657C23.1133 12.0657 21.1991 13.9622 21.1991 16.2951C21.1991 16.7605 21.5808 17.1386 22.0505 17.1386C22.5202 17.1386 22.9019 16.7605 22.9019 16.2951C22.9019 14.8989 24.0528 13.7586 25.462 13.7586C26.8712 13.7586 28.0221 14.8989 28.0221 16.2951C28.0221 16.7605 28.4038 17.1386 28.8735 17.1386C29.3432 17.1386 29.7249 16.7605 29.7249 16.2951C29.7367 13.9622 27.8225 12.0657 25.4679 12.0657Z" fill="#C6A20C"/>
4
+ <path d="M14.3761 16.2893C14.3761 16.7547 14.7578 17.1329 15.2275 17.1329C15.6973 17.1329 16.0789 16.7547 16.0789 16.2893C16.0789 13.9565 14.1647 12.0599 11.8101 12.0599C9.45556 12.0599 7.54724 13.9623 7.54724 16.2893C7.54724 16.7547 7.9289 17.1329 8.39864 17.1329C8.86838 17.1329 9.25005 16.7547 9.25005 16.2893C9.25005 14.8931 10.4009 13.7529 11.8101 13.7529C13.2252 13.7529 14.3761 14.8931 14.3761 16.2893Z" fill="#C6A20C"/>
5
+ <path d="M28.7443 20.4141C28.7443 26.0048 24.1702 30.5425 18.5216 30.5425C12.8729 30.5425 8.29883 26.0106 8.29883 20.4141H28.7443Z" fill="white"/>
6
+ <path d="M28.7443 20.4141C28.7443 26.0048 24.1702 30.5425 18.5216 30.5425C12.8729 30.5425 8.29883 26.0106 8.29883 20.4141H28.7443Z" stroke="#C6A20C" stroke-width="1.68" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
7
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="38" height="37" viewBox="0 0 38 37" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18.5655 36.6044C28.7676 36.6044 37.0381 28.4102 37.0381 18.3022C37.0381 8.19417 28.7676 0 18.5655 0C8.36336 0 0.0928955 8.19417 0.0928955 18.3022C0.0928955 28.4102 8.36336 36.6044 18.5655 36.6044Z" fill="#F9DF70"/>
3
+ <path d="M12.2475 17.8484C13.6567 17.8484 14.8076 16.7082 14.8076 15.312C14.8076 13.9157 13.6567 12.7755 12.2475 12.7755C10.8382 12.7755 9.68738 13.9157 9.68738 15.312C9.68738 16.7082 10.8324 17.8484 12.2475 17.8484ZM12.2475 14.4626C12.7172 14.4626 13.0989 14.8407 13.0989 15.3061C13.0989 15.7716 12.7172 16.1497 12.2475 16.1497C11.7777 16.1497 11.3961 15.7716 11.3961 15.3061C11.3961 14.8407 11.7777 14.4626 12.2475 14.4626Z" fill="#C6A20C"/>
4
+ <path d="M25.9052 12.7755C24.496 12.7755 23.3451 13.9157 23.3451 15.312C23.3451 16.7082 24.496 17.8484 25.9052 17.8484C27.3144 17.8484 28.4653 16.7082 28.4653 15.312C28.4653 13.9157 27.3144 12.7755 25.9052 12.7755ZM25.9052 16.1555C25.4355 16.1555 25.0538 15.7774 25.0538 15.312C25.0538 14.8466 25.4355 14.4684 25.9052 14.4684C26.375 14.4684 26.7566 14.8466 26.7566 15.312C26.7566 15.7774 26.375 16.1555 25.9052 16.1555Z" fill="#C6A20C"/>
5
+ <path d="M27.608 22.9214H10.5388C10.0691 22.9214 9.68738 23.2996 9.68738 23.765C9.68738 24.2304 10.0691 24.6085 10.5388 24.6085H27.608C28.0778 24.6085 28.4594 24.2304 28.4594 23.765C28.4653 23.2996 28.0778 22.9214 27.608 22.9214Z" fill="#C6A20C"/>
6
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="37" height="38" viewBox="0 0 37 38" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18.2241 37.1237C28.289 37.1237 36.4482 28.9305 36.4482 18.8237C36.4482 8.71687 28.289 0.523682 18.2241 0.523682C8.15921 0.523682 0 8.71687 0 18.8237C0 28.9305 8.15921 37.1237 18.2241 37.1237Z" fill="#F9DF70"/>
3
+ <path d="M14.0532 15.4441C14.0532 14.0481 12.9178 12.908 11.5275 12.908C10.1372 12.908 9.00185 14.0481 9.00185 15.4441C9.00185 16.8402 10.1372 17.9803 11.5275 17.9803C12.9178 17.9803 14.0532 16.8402 14.0532 15.4441ZM10.6818 15.4441C10.6818 14.9788 11.0583 14.6007 11.5217 14.6007C11.9851 14.6007 12.3617 14.9788 12.3617 15.4441C12.3617 15.9095 11.9851 16.2876 11.5217 16.2876C11.0583 16.2876 10.6818 15.9095 10.6818 15.4441Z" fill="#C6A20C"/>
4
+ <path d="M24.9956 12.908C23.6054 12.908 22.47 14.0481 22.47 15.4441C22.47 16.8402 23.6054 17.9803 24.9956 17.9803C26.3859 17.9803 27.5213 16.8402 27.5213 15.4441C27.5213 14.0481 26.3917 12.908 24.9956 12.908ZM24.9956 16.2876C24.5322 16.2876 24.1557 15.9095 24.1557 15.4441C24.1557 14.9788 24.5322 14.6007 24.9956 14.6007C25.459 14.6007 25.8356 14.9788 25.8356 15.4441C25.8356 15.9095 25.4648 16.2876 24.9956 16.2876Z" fill="#C6A20C"/>
5
+ <path d="M18.259 23.0526C15.1193 23.0526 12.1302 24.3905 10.0506 26.7173C9.7436 27.0663 9.77256 27.6015 10.1143 27.9098C10.4619 28.2239 10.9948 28.189 11.3019 27.8458C13.0571 25.8738 15.5943 24.7454 18.2532 24.7454C20.9121 24.7454 23.4493 25.8738 25.2045 27.8458C25.3725 28.0319 25.5985 28.125 25.8302 28.125C26.0271 28.125 26.2299 28.0552 26.3921 27.9098C26.7396 27.6015 26.7686 27.0663 26.4558 26.7173C24.3935 24.3905 21.4045 23.0526 18.259 23.0526Z" fill="#C6A20C"/>
6
+ </svg>
@@ -0,0 +1,2 @@
1
+ export { default, Score } from './Score'
2
+ export { default as styles } from './Score.module.css'
@@ -0,0 +1,114 @@
1
+ import React, { useState } from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import Spacer from '../../layout/Spacer'
5
+ import Card from '../../atoms/Card'
6
+ import Paragraph from '../../atoms/Paragraph'
7
+ import Icon from '../../atoms/Icon'
8
+ import Check from '../../atoms/Check'
9
+
10
+ import styles from './Task.module.css'
11
+ import { options } from './constants'
12
+ import withStyles from '../../hocs/withStyles'
13
+
14
+ const handleCheck = ({ isChecked, setIsChecked, isPending, onCheck }) => (
15
+ event
16
+ ) => {
17
+ event && event.stopPropagation()
18
+
19
+ if (!isPending) {
20
+ setIsChecked(!isChecked)
21
+ onCheck({ isChecked: !isChecked })
22
+ }
23
+ }
24
+
25
+ const handleDelete = ({ onDelete }) => (event) => {
26
+ event && event.stopPropagation()
27
+ onDelete()
28
+ }
29
+
30
+ const handleClick = ({ onClick }) => () => {
31
+ onClick()
32
+ }
33
+
34
+ export const Task = ({
35
+ children,
36
+ defaultIsChecked,
37
+ onCheck,
38
+ onClick,
39
+ onDelete,
40
+ getStyles,
41
+ isPending,
42
+ }) => {
43
+ const [isChecked, setIsChecked] = useState(defaultIsChecked && !isPending)
44
+
45
+ return (
46
+ <div className={getStyles('container')}>
47
+ <Card
48
+ onClick={handleClick({ onClick })}
49
+ isClickable={!isPending}
50
+ isDraggable={isPending}
51
+ >
52
+ <div
53
+ className={getStyles('task', ['type'], {
54
+ 'is-checked': isChecked,
55
+ })}
56
+ >
57
+ <div className={getStyles('content')}>
58
+ {isPending ? (
59
+ <Icon name="grip" size="sm" />
60
+ ) : (
61
+ <div
62
+ className={getStyles('check-container')}
63
+ onClick={handleCheck({
64
+ isChecked,
65
+ setIsChecked,
66
+ isPending,
67
+ onCheck,
68
+ })}
69
+ >
70
+ <Check isChecked={isChecked} />
71
+ </div>
72
+ )}
73
+ <Spacer.Horizontal size="xs" />
74
+ <Paragraph
75
+ color={isChecked ? 'muted' : 'base'}
76
+ weight="medium"
77
+ isStriked={isChecked}
78
+ >
79
+ {children}
80
+ </Paragraph>
81
+ </div>
82
+ <Spacer.Horizontal size="sm" />
83
+ <Icon
84
+ name="trash"
85
+ size="sm"
86
+ onClick={handleDelete({ onDelete })}
87
+ background="inverted"
88
+ />
89
+ </div>
90
+ </Card>
91
+ </div>
92
+ )
93
+ }
94
+
95
+ Task.propTypes = {
96
+ children: PropTypes.node.isRequired,
97
+ getStyles: PropTypes.func.isRequired,
98
+ onCheck: PropTypes.func.isRequired,
99
+ onClick: PropTypes.func.isRequired,
100
+ onDelete: PropTypes.func.isRequired,
101
+ type: PropTypes.oneOf(options.types),
102
+ defaultIsChecked: PropTypes.bool,
103
+ isPending: PropTypes.bool,
104
+ }
105
+
106
+ Task.defaultProps = {
107
+ getStyles: () => {},
108
+ onCheck: () => {},
109
+ onClick: () => {},
110
+ onDelete: () => {},
111
+ defaultIsChecked: false,
112
+ }
113
+
114
+ export default withStyles(styles)(Task)
@@ -0,0 +1,47 @@
1
+ .container {
2
+ position: relative;
3
+ width: 100%;
4
+ }
5
+
6
+ .task {
7
+ display: flex;
8
+ width: 100%;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ }
12
+
13
+ .content {
14
+ display: flex;
15
+ width: 100%;
16
+ align-items: center;
17
+ }
18
+
19
+ .type-active:not(.is-checked)::after {
20
+ position: absolute;
21
+ top: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ left: 0;
25
+ border-radius: var(--task-border-radius);
26
+ box-shadow: var(--box-shadow-sm), inset 0 -3px 0 var(--color-green-300);
27
+ content: '';
28
+ pointer-events: none;
29
+ }
30
+
31
+ .type-standby:not(.is-checked)::after {
32
+ position: absolute;
33
+ top: 0;
34
+ right: 0;
35
+ bottom: 0;
36
+ left: 0;
37
+ border-radius: var(--task-border-radius);
38
+ box-shadow: var(--box-shadow-sm), inset 0 -3px 0 var(--color-yellow-400);
39
+ content: '';
40
+ pointer-events: none;
41
+ }
42
+
43
+ .check-container {
44
+ display: inline-flex;
45
+ width: 100%;
46
+ max-width: 35px;
47
+ }
@@ -0,0 +1,47 @@
1
+ import { Task, styles, options } from '.'
2
+
3
+ import {
4
+ getTemplate,
5
+ getListTemplate,
6
+ getOptionsArgTypes,
7
+ } from '../../helpers/storybook'
8
+
9
+ const Template = getTemplate(Task, styles)
10
+ const ListTemplate = getListTemplate(Task, styles)
11
+
12
+ export default {
13
+ title: 'Molecules/Task',
14
+ component: Task,
15
+ args: {
16
+ children: 'Sir Goblin-town feels characters ruined precautions.',
17
+ },
18
+ argTypes: {
19
+ type: getOptionsArgTypes(options.types),
20
+ },
21
+ }
22
+
23
+ export const Default = Template.bind({})
24
+
25
+ export const Long = Template.bind({})
26
+ Long.args = {
27
+ children:
28
+ "Swords are no more use here. Moments shiny rings Cirith nowhere garrison ax pointy endless mention trousers. Retribution Frodo's wrong? Them leaf question require spared houses sapphire Balin. Kind pouring Lothlórien ragged retribution covers lair less goings recognizes unleash. Whence Precious token hidden hire bandy make farming. Shards farmer unfriendly handle Bain gongs. Mend recall sorry oncoming roll unmade cries visitors Lobelia Sackville-Baggins was bidden. Dank rather between short doomed Mellon tomb consequence girl crescent attacking.",
29
+ }
30
+
31
+ export const Checked = Template.bind({})
32
+ Checked.args = {
33
+ defaultIsChecked: true,
34
+ }
35
+
36
+ export const Pending = Template.bind({})
37
+ Pending.args = {
38
+ isPending: true,
39
+ }
40
+
41
+ export const Types = ListTemplate.bind({})
42
+ Types.args = { items: options.types.map((type) => ({ type })) }
43
+
44
+ export const PendingTypes = ListTemplate.bind({})
45
+ PendingTypes.args = {
46
+ items: options.types.map((type) => ({ type, isPending: true })),
47
+ }