imbric-theme 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc.json +3 -0
- package/.commitlintrc.json +3 -0
- package/.editorconfig +13 -0
- package/.eslintcache +1 -0
- package/.eslintrc.json +36 -0
- package/.huskyrc.json +6 -0
- package/.lintstagedrc.json +5 -0
- package/.nvmrc +1 -0
- package/.prettierrc.json +4 -0
- package/.releaserc.json +13 -0
- package/.storybook/main.js +9 -0
- package/.storybook/preview-head.html +2 -0
- package/.storybook/preview.js +32 -0
- package/.stylelintrc.json +14 -0
- package/.vscode/launch.json +15 -0
- package/CHANGELOG.md +0 -0
- package/README.md +69 -0
- package/atoms/Avatar/Avatar.js +36 -0
- package/atoms/Avatar/Avatar.module.css +3 -0
- package/atoms/Avatar/Avatar.stories.js +29 -0
- package/atoms/Avatar/__snapshots__/Avatar.stories.js.snap +105 -0
- package/atoms/Avatar/constants.js +3 -0
- package/atoms/Avatar/helpers.js +7 -0
- package/atoms/Avatar/index.js +3 -0
- package/atoms/Button/Button.js +68 -0
- package/atoms/Button/Button.module.css +63 -0
- package/atoms/Button/Button.stories.js +47 -0
- package/atoms/Button/Button.test.js +60 -0
- package/atoms/Button/__snapshots__/Button.stories.js.snap +191 -0
- package/atoms/Button/constants.js +3 -0
- package/atoms/Button/index.js +3 -0
- package/atoms/Card/Card.js +48 -0
- package/atoms/Card/Card.module.css +52 -0
- package/atoms/Card/Card.stories.js +41 -0
- package/atoms/Card/__snapshots__/Card.stories.js.snap +136 -0
- package/atoms/Card/constants.js +4 -0
- package/atoms/Card/index.js +3 -0
- package/atoms/Check/Check.js +26 -0
- package/atoms/Check/Check.module.css +11 -0
- package/atoms/Check/Check.stories.js +15 -0
- package/atoms/Check/__snapshots__/Check.stories.js.snap +67 -0
- package/atoms/Check/index.js +2 -0
- package/atoms/Divider/Divider.js +19 -0
- package/atoms/Divider/Divider.module.css +5 -0
- package/atoms/Divider/Divider.stories.js +12 -0
- package/atoms/Divider/__snapshots__/Divider.stories.js.snap +22 -0
- package/atoms/Divider/index.js +2 -0
- package/atoms/Heading/Heading.js +37 -0
- package/atoms/Heading/Heading.module.css +66 -0
- package/atoms/Heading/Heading.stories.js +46 -0
- package/atoms/Heading/__snapshots__/Heading.stories.js.snap +189 -0
- package/atoms/Heading/constants.js +5 -0
- package/atoms/Heading/index.js +3 -0
- package/atoms/Icon/Icon.js +66 -0
- package/atoms/Icon/Icon.module.css +112 -0
- package/atoms/Icon/Icon.stories.js +48 -0
- package/atoms/Icon/__snapshots__/Icon.stories.js.snap +1311 -0
- package/atoms/Icon/constants.js +486 -0
- package/atoms/Icon/helpers.js +9 -0
- package/atoms/Icon/index.js +3 -0
- package/atoms/Input/Input.js +49 -0
- package/atoms/Input/Input.module.css +27 -0
- package/atoms/Input/Input.stories.js +32 -0
- package/atoms/Input/__snapshots__/Input.stories.js.snap +101 -0
- package/atoms/Input/constants.js +3 -0
- package/atoms/Input/index.js +3 -0
- package/atoms/Link/Link.js +33 -0
- package/atoms/Link/Link.module.css +14 -0
- package/atoms/Link/Link.stories.js +30 -0
- package/atoms/Link/__snapshots__/Link.stories.js.snap +118 -0
- package/atoms/Link/constants.js +5 -0
- package/atoms/Link/index.js +3 -0
- package/atoms/Loading/Loading.js +30 -0
- package/atoms/Loading/Loading.module.css +51 -0
- package/atoms/Loading/Loading.stories.js +17 -0
- package/atoms/Loading/__snapshots__/Loading.stories.js.snap +26 -0
- package/atoms/Loading/index.js +2 -0
- package/atoms/Modal/Modal.js +98 -0
- package/atoms/Modal/Modal.module.css +85 -0
- package/atoms/Modal/Modal.stories.js +43 -0
- package/atoms/Modal/__snapshots__/Modal.stories.js.snap +239 -0
- package/atoms/Modal/constants.js +1 -0
- package/atoms/Modal/index.js +3 -0
- package/atoms/Paragraph/Paragraph.js +56 -0
- package/atoms/Paragraph/Paragraph.module.css +68 -0
- package/atoms/Paragraph/Paragraph.stories.js +52 -0
- package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +230 -0
- package/atoms/Paragraph/constants.js +5 -0
- package/atoms/Paragraph/index.js +3 -0
- package/atoms/Picture/Picture.js +40 -0
- package/atoms/Picture/Picture.module.css +16 -0
- package/atoms/Picture/Picture.stories.js +32 -0
- package/atoms/Picture/__snapshots__/Picture.stories.js.snap +156 -0
- package/atoms/Picture/index.js +2 -0
- package/atoms/Textarea/Textarea.js +46 -0
- package/atoms/Textarea/Textarea.module.css +25 -0
- package/atoms/Textarea/Textarea.stories.js +16 -0
- package/atoms/Textarea/__snapshots__/Textarea.stories.js.snap +25 -0
- package/atoms/Textarea/index.js +2 -0
- package/codecov.yml +2 -0
- package/helpers/storybook.js +29 -0
- package/helpers/storybook.test.js +40 -0
- package/helpers/styles.js +37 -0
- package/helpers/styles.test.js +222 -0
- package/hocs/withStyles.js +17 -0
- package/hook/useMedia.js +22 -0
- package/index.js +31 -0
- package/jest.config.js +23 -0
- package/jest.setup.js +13 -0
- package/layout/CenteredContent/CenteredContent.js +30 -0
- package/layout/CenteredContent/CenteredContent.module.css +12 -0
- package/layout/CenteredContent/CenteredContent.stories.js +22 -0
- package/layout/CenteredContent/__snapshots__/CenteredContent.stories.js.snap +27 -0
- package/layout/CenteredContent/index.js +2 -0
- package/layout/Container/Container.js +29 -0
- package/layout/Container/Container.module.css +14 -0
- package/layout/Container/Container.stories.js +22 -0
- package/layout/Container/__snapshots__/Container.stories.js.snap +27 -0
- package/layout/Container/index.js +2 -0
- package/layout/FullHeightContent/FullHeightContent.js +40 -0
- package/layout/FullHeightContent/FullHeightContent.module.css +21 -0
- package/layout/FullHeightContent/FullHeightContent.stories.js +22 -0
- package/layout/FullHeightContent/__snapshots__/FullHeightContent.stories.js.snap +41 -0
- package/layout/FullHeightContent/index.js +2 -0
- package/layout/Spacer/Spacer.js +40 -0
- package/layout/Spacer/Spacer.module.css +12 -0
- package/layout/Spacer/Spacer.stories.js +25 -0
- package/layout/Spacer/__snapshots__/Spacer.stories.js.snap +97 -0
- package/layout/Spacer/components/Horizontal/Horizontal.js +43 -0
- package/layout/Spacer/components/Horizontal/Horizontal.stories.js +32 -0
- package/layout/Spacer/components/Horizontal/__snapshots__/Horizontal.stories.js.snap +97 -0
- package/layout/Spacer/components/Horizontal/index.js +1 -0
- package/layout/Spacer/components/Vertical/Vertical.js +31 -0
- package/layout/Spacer/components/Vertical/Vertical.stories.js +25 -0
- package/layout/Spacer/components/Vertical/__snapshots__/Vertical.stories.js.snap +85 -0
- package/layout/Spacer/components/Vertical/index.js +1 -0
- package/layout/Spacer/components/index.js +2 -0
- package/layout/Spacer/constants.js +5 -0
- package/layout/Spacer/helpers.js +3 -0
- package/layout/Spacer/index.js +3 -0
- package/molecules/Accordion/Accordion.js +70 -0
- package/molecules/Accordion/Accordion.module.css +12 -0
- package/molecules/Accordion/Accordion.stories.js +31 -0
- package/molecules/Accordion/__snapshots__/Accordion.stories.js.snap +228 -0
- package/molecules/Accordion/index.js +2 -0
- package/molecules/AddButton/AddButton.js +137 -0
- package/molecules/AddButton/AddButton.module.css +128 -0
- package/molecules/AddButton/AddButton.stories.js +47 -0
- package/molecules/AddButton/__snapshots__/AddButton.stories.js.snap +326 -0
- package/molecules/AddButton/constants.js +6 -0
- package/molecules/AddButton/handlers.js +58 -0
- package/molecules/AddButton/handlers.test.js +19 -0
- package/molecules/AddButton/helpers.js +6 -0
- package/molecules/AddButton/helpers.test.js +41 -0
- package/molecules/AddButton/hooks.js +14 -0
- package/molecules/AddButton/index.js +3 -0
- package/molecules/ButtonIcon/ButtonIcon.js +41 -0
- package/molecules/ButtonIcon/ButtonIcon.stories.js +27 -0
- package/molecules/ButtonIcon/__snapshots__/ButtonIcon.stories.js.snap +178 -0
- package/molecules/ButtonIcon/constants.js +6 -0
- package/molecules/ButtonIcon/index.js +2 -0
- package/molecules/Dropdown/Dropdown.js +59 -0
- package/molecules/Dropdown/Dropdown.module.css +34 -0
- package/molecules/Dropdown/Dropdown.stories.js +41 -0
- package/molecules/Dropdown/__snapshots__/Dropdown.stories.js.snap +181 -0
- package/molecules/Dropdown/index.js +2 -0
- package/molecules/Error/Error.js +35 -0
- package/molecules/Error/Error.module.css +11 -0
- package/molecules/Error/Error.stories.js +18 -0
- package/molecules/Error/__snapshots__/Error.stories.js.snap +134 -0
- package/molecules/Error/index.js +2 -0
- package/molecules/IconLabel/IconLabel.js +83 -0
- package/molecules/IconLabel/IconLabel.module.css +16 -0
- package/molecules/IconLabel/IconLabel.stories.js +25 -0
- package/molecules/IconLabel/__snapshots__/IconLabel.stories.js.snap +211 -0
- package/molecules/IconLabel/constants.js +6 -0
- package/molecules/IconLabel/index.js +3 -0
- package/molecules/LoadingError/LoadingError.js +31 -0
- package/molecules/LoadingError/LoadingError.stories.js +24 -0
- package/molecules/LoadingError/__snapshots__/LoadingError.stories.js.snap +109 -0
- package/molecules/LoadingError/index.js +1 -0
- package/molecules/Score/Score.js +61 -0
- package/molecules/Score/Score.module.css +11 -0
- package/molecules/Score/Score.stories.js +13 -0
- package/molecules/Score/__snapshots__/Score.stories.js.snap +100 -0
- package/molecules/Score/faces/happy.svg +7 -0
- package/molecules/Score/faces/normal.svg +6 -0
- package/molecules/Score/faces/sad.svg +6 -0
- package/molecules/Score/index.js +2 -0
- package/molecules/Task/Task.js +114 -0
- package/molecules/Task/Task.module.css +47 -0
- package/molecules/Task/Task.stories.js +47 -0
- package/molecules/Task/__snapshots__/Task.stories.js.snap +953 -0
- package/molecules/Task/constants.js +1 -0
- package/molecules/Task/index.js +3 -0
- package/molecules/TaskCounter/TaskCounter.js +74 -0
- package/molecules/TaskCounter/TaskCounter.module.css +11 -0
- package/molecules/TaskCounter/TaskCounter.stories.js +26 -0
- package/molecules/TaskCounter/__snapshots__/TaskCounter.stories.js.snap +177 -0
- package/molecules/TaskCounter/index.js +2 -0
- package/package.json +102 -0
- package/scripts/build-tokens.js +40 -0
- package/scripts/create-component.js +127 -0
- package/storybook.test.js +13 -0
- package/styles/globals.css +10 -0
- package/styles/tokens.css +390 -0
- package/templates/component/Component.js +22 -0
- package/templates/component/Component.module.css +3 -0
- package/templates/component/Component.stories.js +23 -0
- package/templates/component/constants.js +1 -0
- package/templates/component/index.js +3 -0
- package/tokens/Token/Helper.js +30 -0
- package/tokens/Token/Token.js +13 -0
- package/tokens/Token/Token.module.css +64 -0
- package/tokens/Token/components/Color.js +21 -0
- package/tokens/Token/components/Color.stories.js +126 -0
- package/tokens/Token/components/FontFamily.js +24 -0
- package/tokens/Token/components/FontFamily.stories.js +32 -0
- package/tokens/Token/components/FontSize.js +24 -0
- package/tokens/Token/components/FontSize.stories.js +31 -0
- package/tokens/Token/components/FontWeight.js +24 -0
- package/tokens/Token/components/FontWeight.stories.js +31 -0
- package/tokens/Token/components/Spacing.js +24 -0
- package/tokens/Token/components/Spacing.stories.js +29 -0
- package/tokens/Token/components/__snapshots__/Color.stories.js.snap +7169 -0
- package/tokens/Token/components/__snapshots__/FontFamily.stories.js.snap +133 -0
- package/tokens/Token/components/__snapshots__/FontSize.stories.js.snap +261 -0
- package/tokens/Token/components/__snapshots__/FontWeight.stories.js.snap +317 -0
- package/tokens/Token/components/__snapshots__/Spacing.stories.js.snap +229 -0
- package/tokens/Token/components/index.js +5 -0
- package/tokens/Token/helpers.js +17 -0
- package/tokens/Token/index.js +1 -0
- package/tokens/index.js +471 -0
- package/utils/isEmpty.js +28 -0
- package/utils/isEmpty.test.js +125 -0
- package/utils/isObject.js +4 -0
- package/utils/keyboardCodes.js +6 -0
- package/utils/testUtils/matchMediaMock.js +14 -0
- package/utils/testUtils/svgrMock.js +2 -0
- package/utils/toCapitalize.js +4 -0
- package/utils/toKebabCase.js +8 -0
- package/utils/toPascalCase.js +20 -0
- package/webpack/cssModules.js +30 -0
- package/webpack/loadConfigs.js +6 -0
- package/webpack/reactInlineSvg.js +22 -0
package/hook/useMedia.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
import { useEffect, useState } from 'react'
|
2
|
+
|
3
|
+
const useMedia = (queries, values, defaultValue) => {
|
4
|
+
const mediaQueryLists = queries.map((q) => window.matchMedia(q))
|
5
|
+
const getValue = () => {
|
6
|
+
const index = mediaQueryLists.findIndex((mql) => mql.matches)
|
7
|
+
return typeof values[index] !== 'undefined' ? values[index] : defaultValue
|
8
|
+
}
|
9
|
+
|
10
|
+
const [value, setValue] = useState(getValue)
|
11
|
+
|
12
|
+
useEffect(() => {
|
13
|
+
const handler = () => setValue(getValue)
|
14
|
+
mediaQueryLists.forEach((mql) => mql.addListener(handler))
|
15
|
+
|
16
|
+
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler))
|
17
|
+
}, [])
|
18
|
+
|
19
|
+
return value
|
20
|
+
}
|
21
|
+
|
22
|
+
export default useMedia
|
package/index.js
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
// Layout
|
2
|
+
export { default as CenteredContent } from './layout/CenteredContent'
|
3
|
+
export { default as Container } from './layout/Container'
|
4
|
+
export { default as FullHeightContent } from './layout/FullHeightContent'
|
5
|
+
export { default as Spacer } from './layout/Spacer'
|
6
|
+
|
7
|
+
// Atoms
|
8
|
+
export { default as Avatar } from './atoms/Avatar'
|
9
|
+
export { default as Button } from './atoms/Button'
|
10
|
+
export { default as Card } from './atoms/Card'
|
11
|
+
export { default as Check } from './atoms/Check'
|
12
|
+
export { default as Divider } from './atoms/Divider'
|
13
|
+
export { default as Heading } from './atoms/Heading'
|
14
|
+
export { default as Icon } from './atoms/Icon'
|
15
|
+
export { default as Input } from './atoms/Input'
|
16
|
+
export { default as Link } from './atoms/Link'
|
17
|
+
export { default as Modal } from './atoms/Modal'
|
18
|
+
export { default as Paragraph } from './atoms/Paragraph'
|
19
|
+
export { default as Picture } from './atoms/Picture'
|
20
|
+
export { default as Textarea } from './atoms/Textarea'
|
21
|
+
|
22
|
+
// Molecules
|
23
|
+
export { default as Accordion } from './molecules/Accordion'
|
24
|
+
export { default as AddButton } from './molecules/AddButton'
|
25
|
+
export { default as ButtonIcon } from './molecules/ButtonIcon'
|
26
|
+
export { default as Dropdown } from './molecules/Dropdown'
|
27
|
+
export { default as LoadingError } from './molecules/LoadingError'
|
28
|
+
export { default as Score } from './molecules/Score'
|
29
|
+
export { default as Task } from './molecules/Task'
|
30
|
+
export { default as TaskCounter } from './molecules/TaskCounter'
|
31
|
+
export { default as IconLabel } from './molecules/IconLabel'
|
package/jest.config.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module.exports = {
|
2
|
+
moduleNameMapper: {
|
3
|
+
'\\.css$': 'identity-obj-proxy',
|
4
|
+
'\\.svg$': '<rootDir>/utils/testUtils/svgrMock.js',
|
5
|
+
},
|
6
|
+
setupFilesAfterEnv: ['./jest.setup.js'],
|
7
|
+
transform: {
|
8
|
+
'^.+\\.stories\\.jsx?$': '@storybook/addon-storyshots/injectFileName',
|
9
|
+
'^.+\\.jsx?$': 'babel-jest',
|
10
|
+
},
|
11
|
+
collectCoverageFrom: [
|
12
|
+
'{atoms,molecules,layout}/**/!(index).js',
|
13
|
+
'{hocs,helpers}/*.js',
|
14
|
+
],
|
15
|
+
coverageThreshold: {
|
16
|
+
global: {
|
17
|
+
statements: 60,
|
18
|
+
branches: 60,
|
19
|
+
lines: 60,
|
20
|
+
functions: 60,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
}
|
package/jest.setup.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// https://console.spec.whatwg.org/#loglevel-severity
|
2
|
+
const CONSOLE_LEVELS = ['debug', 'log', 'info', 'warn', 'error']
|
3
|
+
|
4
|
+
// Notice that by default the levels will be ["error"]
|
5
|
+
const allowedConsoleLevels = CONSOLE_LEVELS.slice(
|
6
|
+
CONSOLE_LEVELS.indexOf(process.env.CONSOLE_LEVEL)
|
7
|
+
)
|
8
|
+
|
9
|
+
global.console = CONSOLE_LEVELS.reduce((levels, level) => {
|
10
|
+
return allowedConsoleLevels.includes(level)
|
11
|
+
? { ...levels, [level]: console[level] }
|
12
|
+
: { ...levels, [level]: jest.fn() }
|
13
|
+
}, {})
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
import styles from './CenteredContent.module.css'
|
5
|
+
import withStyles from '../../hocs/withStyles'
|
6
|
+
|
7
|
+
export const CenteredContent = ({ getStyles, children, isPlayground }) => {
|
8
|
+
return (
|
9
|
+
<div
|
10
|
+
className={getStyles('centered-content', {
|
11
|
+
'is-playground': isPlayground,
|
12
|
+
})}
|
13
|
+
>
|
14
|
+
{children}
|
15
|
+
</div>
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
CenteredContent.propTypes = {
|
20
|
+
children: PropTypes.node.isRequired,
|
21
|
+
getStyles: PropTypes.func.isRequired,
|
22
|
+
isPlayground: PropTypes.bool,
|
23
|
+
}
|
24
|
+
|
25
|
+
CenteredContent.defaultProps = {
|
26
|
+
isPlayground: false,
|
27
|
+
getStyles: () => {},
|
28
|
+
}
|
29
|
+
|
30
|
+
export default withStyles(styles)(CenteredContent)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { CenteredContent, styles } from '.'
|
2
|
+
|
3
|
+
import { getTemplate } from '../../helpers/storybook'
|
4
|
+
|
5
|
+
const Template = getTemplate(CenteredContent, styles)
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'Layout/CenteredContent',
|
9
|
+
component: CenteredContent,
|
10
|
+
args: {
|
11
|
+
isPlayground: true,
|
12
|
+
children: `Farthings pulled strain? Half they'll greater land sordid Elessar. Glamdring um 17 13 motion? Creaked fate spawning chief lords loved loveliest ashes Elfs witness. Brook born Caradhras dining raining! Seeing-stones taking unlost working. A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to. Oakenshield despite distinct prosperous wields relight dark weighed leader reaches rid honor. Moments poison Sackville-Bagginses echoes dozens fend get. Scales exist apple Gundabad retaken bunch agreeable mantle cannot name's seasoning private.
|
13
|
+
Brave dry defeats? Remembered unleashed Denethor niceties legacy. Streets cares pretty Brandybucks ostler. Intact dispatch their expenses suffered flaming bacon should Fili? Jacksie begins hallway needed tracked Gondor's wonderful popularity. Seemed ears perfectly Oakenshield's pale fall animals stabs betrayed grumbling? Stuff awake Brandybuck large done. Curse you and all the halflings!
|
14
|
+
Dared sit torment goes Anárion forgiven west. Summon Bucklebury ship. Terms none Farthings. Tea choose Dwarvish! Leagues gracious carpet payment Brandywine senses very thousand! Don't you leave him, Samwise Gamgee. Firestorm raising Shire reaction mud morninged shines death should! It'll Halflings nab pot drove start. Carpet Lasgalen seen sleepies!
|
15
|
+
Seeing renown knocked battered contend World shepherd. Roof sautéed kingdom agree curtain lived preparing down material Galion appearance! Faramir one-fourteenth study talked amongst fisherman barren recoil responsible. There is one Dwarf yet in Moria who still draws breath. Boats wait exaggerate guessed Muil usurper suffice. Unspoken swears stands serpent depart Mithril. Ugly threat Dwarf possessions yours homage long-term unmade. Well-earned suffice tapestry tongue piled smoke lacerations talisman helps Dragon-Slayer crown? Blanket shan't dare appearances hours grave Muil.`,
|
16
|
+
},
|
17
|
+
argTypes: {
|
18
|
+
children: { control: 'text' },
|
19
|
+
},
|
20
|
+
}
|
21
|
+
|
22
|
+
export const Default = Template.bind({})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Layout/CenteredContent 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="centered-content is-playground"
|
20
|
+
>
|
21
|
+
Farthings pulled strain? Half they'll greater land sordid Elessar. Glamdring um 17 13 motion? Creaked fate spawning chief lords loved loveliest ashes Elfs witness. Brook born Caradhras dining raining! Seeing-stones taking unlost working. A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to. Oakenshield despite distinct prosperous wields relight dark weighed leader reaches rid honor. Moments poison Sackville-Bagginses echoes dozens fend get. Scales exist apple Gundabad retaken bunch agreeable mantle cannot name's seasoning private.
|
22
|
+
Brave dry defeats? Remembered unleashed Denethor niceties legacy. Streets cares pretty Brandybucks ostler. Intact dispatch their expenses suffered flaming bacon should Fili? Jacksie begins hallway needed tracked Gondor's wonderful popularity. Seemed ears perfectly Oakenshield's pale fall animals stabs betrayed grumbling? Stuff awake Brandybuck large done. Curse you and all the halflings!
|
23
|
+
Dared sit torment goes Anárion forgiven west. Summon Bucklebury ship. Terms none Farthings. Tea choose Dwarvish! Leagues gracious carpet payment Brandywine senses very thousand! Don't you leave him, Samwise Gamgee. Firestorm raising Shire reaction mud morninged shines death should! It'll Halflings nab pot drove start. Carpet Lasgalen seen sleepies!
|
24
|
+
Seeing renown knocked battered contend World shepherd. Roof sautéed kingdom agree curtain lived preparing down material Galion appearance! Faramir one-fourteenth study talked amongst fisherman barren recoil responsible. There is one Dwarf yet in Moria who still draws breath. Boats wait exaggerate guessed Muil usurper suffice. Unspoken swears stands serpent depart Mithril. Ugly threat Dwarf possessions yours homage long-term unmade. Well-earned suffice tapestry tongue piled smoke lacerations talisman helps Dragon-Slayer crown? Blanket shan't dare appearances hours grave Muil.
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
`;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
import styles from './Container.module.css'
|
4
|
+
import withStyles from '../../hocs/withStyles'
|
5
|
+
|
6
|
+
export const Container = ({ getStyles, children, isPlayground }) => {
|
7
|
+
return (
|
8
|
+
<div
|
9
|
+
className={getStyles('container', {
|
10
|
+
'is-playground': isPlayground,
|
11
|
+
})}
|
12
|
+
>
|
13
|
+
{children}
|
14
|
+
</div>
|
15
|
+
)
|
16
|
+
}
|
17
|
+
|
18
|
+
Container.propTypes = {
|
19
|
+
children: PropTypes.node.isRequired,
|
20
|
+
getStyles: PropTypes.func.isRequired,
|
21
|
+
isPlayground: PropTypes.bool,
|
22
|
+
}
|
23
|
+
|
24
|
+
Container.defaultProps = {
|
25
|
+
isPlayground: false,
|
26
|
+
getStyles: () => {},
|
27
|
+
}
|
28
|
+
|
29
|
+
export default withStyles(styles)(Container)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
.container {
|
2
|
+
display: flex;
|
3
|
+
width: 100%;
|
4
|
+
max-width: var(--container-max-width);
|
5
|
+
height: 100%;
|
6
|
+
flex: auto;
|
7
|
+
justify-content: center;
|
8
|
+
padding: 20px 15px 20px;
|
9
|
+
margin: 0 auto;
|
10
|
+
}
|
11
|
+
|
12
|
+
.is-playground {
|
13
|
+
border: var(--border-width-thick) dashed var(--color-primary);
|
14
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Container, styles } from '.'
|
2
|
+
|
3
|
+
import { getTemplate } from '../../helpers/storybook'
|
4
|
+
|
5
|
+
const Template = getTemplate(Container, styles)
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'Layout/Container',
|
9
|
+
component: Container,
|
10
|
+
args: {
|
11
|
+
isPlayground: true,
|
12
|
+
children: `Farthings pulled strain? Half they'll greater land sordid Elessar. Glamdring um 17 13 motion? Creaked fate spawning chief lords loved loveliest ashes Elfs witness. Brook born Caradhras dining raining! Seeing-stones taking unlost working. A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to. Oakenshield despite distinct prosperous wields relight dark weighed leader reaches rid honor. Moments poison Sackville-Bagginses echoes dozens fend get. Scales exist apple Gundabad retaken bunch agreeable mantle cannot name's seasoning private.
|
13
|
+
Brave dry defeats? Remembered unleashed Denethor niceties legacy. Streets cares pretty Brandybucks ostler. Intact dispatch their expenses suffered flaming bacon should Fili? Jacksie begins hallway needed tracked Gondor's wonderful popularity. Seemed ears perfectly Oakenshield's pale fall animals stabs betrayed grumbling? Stuff awake Brandybuck large done. Curse you and all the halflings!
|
14
|
+
Dared sit torment goes Anárion forgiven west. Summon Bucklebury ship. Terms none Farthings. Tea choose Dwarvish! Leagues gracious carpet payment Brandywine senses very thousand! Don't you leave him, Samwise Gamgee. Firestorm raising Shire reaction mud morninged shines death should! It'll Halflings nab pot drove start. Carpet Lasgalen seen sleepies!
|
15
|
+
Seeing renown knocked battered contend World shepherd. Roof sautéed kingdom agree curtain lived preparing down material Galion appearance! Faramir one-fourteenth study talked amongst fisherman barren recoil responsible. There is one Dwarf yet in Moria who still draws breath. Boats wait exaggerate guessed Muil usurper suffice. Unspoken swears stands serpent depart Mithril. Ugly threat Dwarf possessions yours homage long-term unmade. Well-earned suffice tapestry tongue piled smoke lacerations talisman helps Dragon-Slayer crown? Blanket shan't dare appearances hours grave Muil.`,
|
16
|
+
},
|
17
|
+
argTypes: {
|
18
|
+
children: { control: 'text' },
|
19
|
+
},
|
20
|
+
}
|
21
|
+
|
22
|
+
export const Default = Template.bind({})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Layout/Container 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="container is-playground"
|
20
|
+
>
|
21
|
+
Farthings pulled strain? Half they'll greater land sordid Elessar. Glamdring um 17 13 motion? Creaked fate spawning chief lords loved loveliest ashes Elfs witness. Brook born Caradhras dining raining! Seeing-stones taking unlost working. A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to. Oakenshield despite distinct prosperous wields relight dark weighed leader reaches rid honor. Moments poison Sackville-Bagginses echoes dozens fend get. Scales exist apple Gundabad retaken bunch agreeable mantle cannot name's seasoning private.
|
22
|
+
Brave dry defeats? Remembered unleashed Denethor niceties legacy. Streets cares pretty Brandybucks ostler. Intact dispatch their expenses suffered flaming bacon should Fili? Jacksie begins hallway needed tracked Gondor's wonderful popularity. Seemed ears perfectly Oakenshield's pale fall animals stabs betrayed grumbling? Stuff awake Brandybuck large done. Curse you and all the halflings!
|
23
|
+
Dared sit torment goes Anárion forgiven west. Summon Bucklebury ship. Terms none Farthings. Tea choose Dwarvish! Leagues gracious carpet payment Brandywine senses very thousand! Don't you leave him, Samwise Gamgee. Firestorm raising Shire reaction mud morninged shines death should! It'll Halflings nab pot drove start. Carpet Lasgalen seen sleepies!
|
24
|
+
Seeing renown knocked battered contend World shepherd. Roof sautéed kingdom agree curtain lived preparing down material Galion appearance! Faramir one-fourteenth study talked amongst fisherman barren recoil responsible. There is one Dwarf yet in Moria who still draws breath. Boats wait exaggerate guessed Muil usurper suffice. Unspoken swears stands serpent depart Mithril. Ugly threat Dwarf possessions yours homage long-term unmade. Well-earned suffice tapestry tongue piled smoke lacerations talisman helps Dragon-Slayer crown? Blanket shan't dare appearances hours grave Muil.
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
`;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
import Spacer from '../Spacer'
|
5
|
+
|
6
|
+
import styles from './FullHeightContent.module.css'
|
7
|
+
import withStyles from '../../hocs/withStyles'
|
8
|
+
|
9
|
+
export const FullHeightContent = ({
|
10
|
+
getStyles,
|
11
|
+
isPlayground,
|
12
|
+
content,
|
13
|
+
footer,
|
14
|
+
}) => {
|
15
|
+
return (
|
16
|
+
<div
|
17
|
+
className={getStyles('full-height-content', {
|
18
|
+
'is-playground': isPlayground,
|
19
|
+
})}
|
20
|
+
>
|
21
|
+
<div className={styles.content}>{content}</div>
|
22
|
+
<Spacer.Vertical size="sm" />
|
23
|
+
<div className={styles.footer}>{footer}</div>
|
24
|
+
</div>
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
FullHeightContent.propTypes = {
|
29
|
+
getStyles: PropTypes.func.isRequired,
|
30
|
+
content: PropTypes.node.isRequired,
|
31
|
+
footer: PropTypes.node.isRequired,
|
32
|
+
isPlayground: PropTypes.bool,
|
33
|
+
}
|
34
|
+
|
35
|
+
FullHeightContent.defaultProps = {
|
36
|
+
isPlayground: false,
|
37
|
+
getStyles: () => {},
|
38
|
+
}
|
39
|
+
|
40
|
+
export default withStyles(styles)(FullHeightContent)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.full-height-content {
|
2
|
+
display: flex;
|
3
|
+
height: 100%;
|
4
|
+
flex: auto;
|
5
|
+
flex-direction: column;
|
6
|
+
justify-content: space-between;
|
7
|
+
}
|
8
|
+
|
9
|
+
.content {
|
10
|
+
display: flex;
|
11
|
+
flex-direction: column;
|
12
|
+
align-items: stretch;
|
13
|
+
}
|
14
|
+
|
15
|
+
.footer {
|
16
|
+
text-align: center;
|
17
|
+
}
|
18
|
+
|
19
|
+
.is-playground {
|
20
|
+
border: var(--border-width-thick) dashed var(--color-primary);
|
21
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { FullHeightContent, styles } from '.'
|
2
|
+
|
3
|
+
import { getTemplate } from '../../helpers/storybook'
|
4
|
+
|
5
|
+
const Template = getTemplate(FullHeightContent, styles)
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'Layout/FullHeightContent',
|
9
|
+
component: FullHeightContent,
|
10
|
+
args: {
|
11
|
+
isPlayground: true,
|
12
|
+
content:
|
13
|
+
'Mice defiling required Bilbo sailing unspoiled this hunting. 14th refuge knowing breath Middle-earth sack demon children?',
|
14
|
+
footer:
|
15
|
+
'Ambition living aid indeed mutton suffered l failing kindness Éothain? Red others Goblin-town spot stuff riddles hero?',
|
16
|
+
},
|
17
|
+
argTypes: {
|
18
|
+
children: { control: 'array' },
|
19
|
+
},
|
20
|
+
}
|
21
|
+
|
22
|
+
export const Default = Template.bind({})
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Layout/FullHeightContent 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="full-height-content is-playground"
|
20
|
+
>
|
21
|
+
<div
|
22
|
+
className="content"
|
23
|
+
>
|
24
|
+
Mice defiling required Bilbo sailing unspoiled this hunting. 14th refuge knowing breath Middle-earth sack demon children?
|
25
|
+
</div>
|
26
|
+
<div
|
27
|
+
className="spacer vertical"
|
28
|
+
style={
|
29
|
+
Object {
|
30
|
+
"height": 15,
|
31
|
+
}
|
32
|
+
}
|
33
|
+
/>
|
34
|
+
<div
|
35
|
+
className="footer"
|
36
|
+
>
|
37
|
+
Ambition living aid indeed mutton suffered l failing kindness Éothain? Red others Goblin-town spot stuff riddles hero?
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
`;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
import { Vertical, Horizontal } from './components'
|
5
|
+
|
6
|
+
import styles from './Spacer.module.css'
|
7
|
+
import { mapSize } from './helpers'
|
8
|
+
import withStyles from '../../hocs/withStyles'
|
9
|
+
|
10
|
+
export const Spacer = ({ getStyles, size, isPlayground }) => (
|
11
|
+
<div
|
12
|
+
className={getStyles('spacer', {
|
13
|
+
'is-playground': isPlayground,
|
14
|
+
})}
|
15
|
+
style={{
|
16
|
+
display: 'inline-block',
|
17
|
+
width: mapSize(size),
|
18
|
+
height: mapSize(size),
|
19
|
+
}}
|
20
|
+
/>
|
21
|
+
)
|
22
|
+
|
23
|
+
Spacer.propTypes = {
|
24
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
25
|
+
getStyles: PropTypes.func.isRequired,
|
26
|
+
isPlayground: PropTypes.bool,
|
27
|
+
}
|
28
|
+
|
29
|
+
Spacer.defaultProps = {
|
30
|
+
size: 'none',
|
31
|
+
isPlayground: false,
|
32
|
+
getStyles: () => {},
|
33
|
+
}
|
34
|
+
|
35
|
+
const SpacerWithStyles = withStyles(styles)(Spacer)
|
36
|
+
|
37
|
+
SpacerWithStyles.Vertical = Vertical
|
38
|
+
SpacerWithStyles.Horizontal = Horizontal
|
39
|
+
|
40
|
+
export default SpacerWithStyles
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { Spacer, options, styles } from '.'
|
2
|
+
|
3
|
+
import {
|
4
|
+
getTemplate,
|
5
|
+
getListTemplate,
|
6
|
+
getOptionsArgTypes,
|
7
|
+
} from '../../helpers/storybook'
|
8
|
+
|
9
|
+
const Template = getTemplate(Spacer, styles)
|
10
|
+
const ListTemplate = getListTemplate(Spacer, styles)
|
11
|
+
|
12
|
+
export default {
|
13
|
+
title: 'Layout/Spacer/Default',
|
14
|
+
component: Spacer,
|
15
|
+
args: { isPlayground: true },
|
16
|
+
argTypes: {
|
17
|
+
size: getOptionsArgTypes(options.sizes),
|
18
|
+
},
|
19
|
+
parameters: { __sb: { fd: 'row' } },
|
20
|
+
}
|
21
|
+
|
22
|
+
export const Default = Template.bind({})
|
23
|
+
|
24
|
+
export const Sizes = ListTemplate.bind({})
|
25
|
+
Sizes.args = { items: options.sizes.map((size) => ({ size })) }
|
@@ -0,0 +1,97 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Storyshots Layout/Spacer/Default Default 1`] = `
|
4
|
+
<div
|
5
|
+
style={
|
6
|
+
Object {
|
7
|
+
"alignContent": "flex-start",
|
8
|
+
"display": "flex",
|
9
|
+
"flexDirection": "row",
|
10
|
+
"flexWrap": "wrap",
|
11
|
+
"gap": "10px 30px",
|
12
|
+
"height": "100%",
|
13
|
+
"justifyContent": "flex-start",
|
14
|
+
"maxHeight": "auto",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
>
|
18
|
+
<div
|
19
|
+
className="spacer is-playground"
|
20
|
+
style={
|
21
|
+
Object {
|
22
|
+
"display": "inline-block",
|
23
|
+
"height": 0,
|
24
|
+
"width": 0,
|
25
|
+
}
|
26
|
+
}
|
27
|
+
/>
|
28
|
+
</div>
|
29
|
+
`;
|
30
|
+
|
31
|
+
exports[`Storyshots Layout/Spacer/Default Sizes 1`] = `
|
32
|
+
<div
|
33
|
+
style={
|
34
|
+
Object {
|
35
|
+
"alignContent": "flex-start",
|
36
|
+
"display": "flex",
|
37
|
+
"flexDirection": "row",
|
38
|
+
"flexWrap": "wrap",
|
39
|
+
"gap": "10px 30px",
|
40
|
+
"height": "100%",
|
41
|
+
"justifyContent": "flex-start",
|
42
|
+
"maxHeight": "auto",
|
43
|
+
}
|
44
|
+
}
|
45
|
+
>
|
46
|
+
<div
|
47
|
+
className="spacer is-playground"
|
48
|
+
style={
|
49
|
+
Object {
|
50
|
+
"display": "inline-block",
|
51
|
+
"height": 0,
|
52
|
+
"width": 0,
|
53
|
+
}
|
54
|
+
}
|
55
|
+
/>
|
56
|
+
<div
|
57
|
+
className="spacer is-playground"
|
58
|
+
style={
|
59
|
+
Object {
|
60
|
+
"display": "inline-block",
|
61
|
+
"height": 5,
|
62
|
+
"width": 5,
|
63
|
+
}
|
64
|
+
}
|
65
|
+
/>
|
66
|
+
<div
|
67
|
+
className="spacer is-playground"
|
68
|
+
style={
|
69
|
+
Object {
|
70
|
+
"display": "inline-block",
|
71
|
+
"height": 15,
|
72
|
+
"width": 15,
|
73
|
+
}
|
74
|
+
}
|
75
|
+
/>
|
76
|
+
<div
|
77
|
+
className="spacer is-playground"
|
78
|
+
style={
|
79
|
+
Object {
|
80
|
+
"display": "inline-block",
|
81
|
+
"height": 20,
|
82
|
+
"width": 20,
|
83
|
+
}
|
84
|
+
}
|
85
|
+
/>
|
86
|
+
<div
|
87
|
+
className="spacer is-playground"
|
88
|
+
style={
|
89
|
+
Object {
|
90
|
+
"display": "inline-block",
|
91
|
+
"height": 40,
|
92
|
+
"width": 40,
|
93
|
+
}
|
94
|
+
}
|
95
|
+
/>
|
96
|
+
</div>
|
97
|
+
`;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
import { mapSize } from '../../helpers'
|
4
|
+
|
5
|
+
import styles from '../../Spacer.module.css'
|
6
|
+
import withStyles from '../../../../hocs/withStyles'
|
7
|
+
|
8
|
+
export const Horizontal = ({
|
9
|
+
getStyles,
|
10
|
+
size,
|
11
|
+
height,
|
12
|
+
maxHeight,
|
13
|
+
isPlayground,
|
14
|
+
}) => (
|
15
|
+
<div
|
16
|
+
className={getStyles('spacer', 'horizontal', {
|
17
|
+
'is-playground': isPlayground,
|
18
|
+
})}
|
19
|
+
style={{
|
20
|
+
height,
|
21
|
+
maxHeight,
|
22
|
+
width: mapSize(size),
|
23
|
+
}}
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
|
27
|
+
Horizontal.propTypes = {
|
28
|
+
getStyles: PropTypes.func.isRequired,
|
29
|
+
size: PropTypes.string,
|
30
|
+
isPlayground: PropTypes.bool,
|
31
|
+
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
32
|
+
maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
33
|
+
}
|
34
|
+
|
35
|
+
Horizontal.defaultProps = {
|
36
|
+
size: 'none',
|
37
|
+
height: '100%',
|
38
|
+
maxHeight: 'auto',
|
39
|
+
isPlayground: false,
|
40
|
+
getStyles: () => {},
|
41
|
+
}
|
42
|
+
|
43
|
+
export default withStyles(styles)(Horizontal)
|