@platformatic/ui-components 0.1.12 → 0.1.14

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.
@@ -0,0 +1,26 @@
1
+ name: run tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths-ignore:
8
+ - '**.md'
9
+ pull_request:
10
+ paths-ignore:
11
+ - '**.md'
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - uses: actions/setup-node@v3
19
+ with:
20
+ node-version: 18
21
+ - run: npm ci
22
+ - run: npm run lint
23
+ - run: npm run build
24
+ - run: npm run tailwind
25
+ - run: npm test
26
+
package/index.js CHANGED
@@ -17,6 +17,12 @@ import TabbedWindow from './src/components/TabbedWindow'
17
17
  import TextWithLabel from './src/components/TextWithLabel'
18
18
  import Versions from './src/components/Versions'
19
19
  import VerticalSeparator from './src/components/VerticalSeparator'
20
+ import FollowUs from './src/components/FollowUs'
21
+ import List from './src/components/List'
22
+ import ListElement from './src/components/ListElement'
23
+ import Logo from './src/components/Logo'
24
+ import Box from './src/components/Box'
25
+ import FrontpageBackground from './src/components/FrontpageBackground'
20
26
  export {
21
27
  ApiSummary,
22
28
  ApiDetails,
@@ -34,5 +40,11 @@ export {
34
40
  TabbedWindow,
35
41
  TextWithLabel,
36
42
  Versions,
37
- VerticalSeparator
43
+ VerticalSeparator,
44
+ FollowUs,
45
+ List,
46
+ ListElement,
47
+ Logo,
48
+ Box,
49
+ FrontpageBackground
38
50
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@platformatic/ui-components",
3
3
  "description": "Platformatic UI Components",
4
- "version": "0.1.12",
4
+ "version": "0.1.14",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "scripts": {
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "@fortawesome/fontawesome-svg-core": "^6.2.0",
21
21
  "@fortawesome/free-brands-svg-icons": "^6.2.0",
22
+ "@fortawesome/free-regular-svg-icons": "^6.2.0",
22
23
  "@fortawesome/free-solid-svg-icons": "^6.2.0",
23
24
  "@fortawesome/react-fontawesome": "^0.2.0",
24
25
  "autoprefixer": "^10.4.12",
@@ -29,6 +30,7 @@
29
30
  },
30
31
  "devDependencies": {
31
32
  "@babel/core": "^7.19.3",
33
+ "@fastify/pre-commit": "^2.0.2",
32
34
  "@storybook/addon-actions": "^6.5.12",
33
35
  "@storybook/addon-essentials": "^6.5.12",
34
36
  "@storybook/addon-interactions": "^6.5.12",
@@ -42,6 +44,7 @@
42
44
  "@types/react-dom": "^18.0.6",
43
45
  "@vitejs/plugin-react": "^2.1.0",
44
46
  "babel-loader": "^8.2.5",
47
+ "happy-dom": "^7.6.6",
45
48
  "jsdom": "^20.0.1",
46
49
  "react-test-renderer": "^18.2.0",
47
50
  "snazzy": "^9.0.0",
@@ -59,5 +62,9 @@
59
62
  "ignore": [
60
63
  "/dist"
61
64
  ]
62
- }
65
+ },
66
+ "pre-commit": [
67
+ "lint",
68
+ "test"
69
+ ]
63
70
  }
@@ -0,0 +1,11 @@
1
+ 'use strict'
2
+
3
+ import styles from './Box.module.css'
4
+ import React from 'react'
5
+ export default function Box (props) {
6
+ return (
7
+ <div className={styles.box}>
8
+ {props.children}
9
+ </div>
10
+ )
11
+ }
@@ -0,0 +1,3 @@
1
+ .box {
2
+ @apply mx-24 my-24 flex flex-col
3
+ }
@@ -0,0 +1,28 @@
1
+ import styles from './Button.module.css'
2
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
3
+ export default function Button ({ icon, label, onClick, primary, color, ...props }) {
4
+ let buttonClass = 'primary'
5
+ if (!primary) {
6
+ buttonClass = 'secondary'
7
+ }
8
+
9
+ let colorClass = 'green'
10
+ if (color === 'red') {
11
+ colorClass = 'red'
12
+ }
13
+ return (
14
+ <button className={`${styles.button} ${styles[buttonClass + '-' + colorClass]}`}>
15
+ {icon ? <FontAwesomeIcon icon={icon} className='mr-2' data-testid='button-icon' /> : null}
16
+ <span>{label}</span>
17
+ </button>
18
+ // <div className={styles.container} onClick={onClick}>
19
+ // <div
20
+ // className={`${styles.button} ${styles[buttonClass]}`}
21
+ // data-testid='button'
22
+ // {...props}
23
+ // >
24
+ // {icon ? <FontAwesomeIcon icon={icon} className='mr-2' data-testid='button-icon' /> : null} {label}
25
+ // </div>
26
+ // </div>
27
+ )
28
+ }
@@ -0,0 +1,17 @@
1
+ .button {
2
+ @apply py-2 px-2 rounded text-center cursor-pointer
3
+ }
4
+
5
+ .primary-green {
6
+ @apply text-main-dark-blue bg-light-green;
7
+ }
8
+ .secondary-green {
9
+ @apply border-main-green text-main-green bg-none border border-solid box-border rounded-md font-normal;
10
+ }
11
+
12
+ .primary-red {
13
+ @apply text-main-dark-blue bg-error-red;
14
+ }
15
+ .secondary-red {
16
+ @apply border-error-red text-error-red bg-none border border-solid box-border rounded-md font-normal;
17
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import styles from './FollowUs.module.css'
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4
+ import { faGithub, faTwitter, faLinkedin, faDiscord } from '@fortawesome/free-brands-svg-icons'
5
+
6
+ export default function FollowUs ({ label = 'FOLLOW US ON' }) {
7
+ return (
8
+ <div className={styles.container}>
9
+ <div className={styles.label}>
10
+ {label}
11
+ </div>
12
+ <div className={styles.icon}>
13
+ <a href='https://twitter.com/platformatic' target='_blank' rel='noopener noreferrer'>
14
+ <FontAwesomeIcon icon={faTwitter} className='mr-2 text-white' />
15
+ </a>
16
+ </div>
17
+ <div className={styles.icon}>
18
+ <a href='https://www.linkedin.com/company/platformatic/' target='_blank' rel='noopener noreferrer'>
19
+ <FontAwesomeIcon icon={faLinkedin} className='mr-2 text-white' />
20
+ </a>
21
+ </div>
22
+ <div className={styles.icon}>
23
+ <a href='https://github.com/platformatic' target='_blank' rel='noopener noreferrer'>
24
+ <FontAwesomeIcon icon={faGithub} className='mr-2 text-white' />
25
+ </a>
26
+ </div>
27
+ <div className={styles.icon}>
28
+ <a href='https://discord.gg/platformatic' target='_blank' rel='noopener noreferrer'>
29
+ <FontAwesomeIcon icon={faDiscord} className='mr-2 text-white' />
30
+ </a>
31
+ </div>
32
+
33
+ </div>
34
+ )
35
+ }
@@ -0,0 +1,11 @@
1
+ .container {
2
+ @apply flex w-96
3
+ }
4
+
5
+ .label {
6
+ @apply uppercase text-light-green
7
+ }
8
+
9
+ .icon {
10
+ @apply text-white ml-4
11
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+ import styles from './FrontpageBackground.module.css'
3
+
4
+ export default function FrontpageBackgound ({ label = 'platformatic', ...props }) {
5
+ return (
6
+ <div className={styles.bg}>
7
+ <div className={styles.label}> {label} </div>
8
+ {props.children}
9
+ </div>
10
+ )
11
+ }
@@ -0,0 +1,10 @@
1
+ /* let's use some direct CSS here, with tailwind is quite convoluted to obtain the correct radial gradient */
2
+ .bg {
3
+ background: radial-gradient(circle at 0% 0%, rgba(33, 250, 144, 0.4) 0%, rgba(6, 31, 55, 0.4) 35%);
4
+ }
5
+
6
+ .label {
7
+ @apply text-light-green font-semibold w-full text-left uppercase px-8 py-4 text-clip
8
+ }
9
+
10
+
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+ import styles from './Input.module.css'
3
+ import commonStyles from './Common.module.css'
4
+ export default function Input ({ placeholder, value, name }) {
5
+ return (
6
+ <div className={`${styles.inputContainer} ${commonStyles.padded}`}>
7
+ <input type='text' name={name} value={value} placeholder={placeholder} className='grow' />
8
+ </div>
9
+ )
10
+ }
@@ -0,0 +1,7 @@
1
+ .inputContainer {
2
+ @apply flex justify-between w-full h-10 text-white border-main-green border border-solid box-border rounded-md;
3
+ }
4
+
5
+ .input {
6
+ @apply grow focus:outline-none
7
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import styles from './List.module.css'
3
+
4
+ export default function List ({ title, ...props }) {
5
+ return (
6
+ <div className={styles.container}>
7
+ {title &&
8
+ <div
9
+ className={styles.title}
10
+ data-testid='list-title'
11
+ {...props}
12
+ >
13
+ {title}
14
+ </div>}
15
+ <div className={styles.elements}>
16
+ {props.children}
17
+ </div>
18
+ </div>
19
+ )
20
+ }
@@ -0,0 +1,11 @@
1
+ .title {
2
+ @apply text-light-green font-bold w-full text-left uppercase
3
+ }
4
+
5
+ .container {
6
+ @apply w-full
7
+ }
8
+
9
+ .elements {
10
+ @apply flex flex-col
11
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
3
+ import { faCircleCheck } from '@fortawesome/free-regular-svg-icons'
4
+ import styles from './ListElement.module.css'
5
+ export default function List ({ title, detail }) {
6
+ return (
7
+ <div className={styles.container}>
8
+ <div className={styles.iconCol}>
9
+ <div data-testid='list-element-title-icon' className={styles.icon}>
10
+ <FontAwesomeIcon icon={faCircleCheck} />
11
+ </div>
12
+ </div>
13
+ <div className={styles.textCol}>
14
+ <div className={styles.title} data-testid='list-element-title'>
15
+ {title}
16
+ </div>
17
+ <div data-test-id='list-element-detail'>
18
+ {detail}
19
+ </div>
20
+ </div>
21
+ </div>
22
+ )
23
+ }
@@ -0,0 +1,23 @@
1
+ .container {
2
+ @apply flex flex-row my-4
3
+ }
4
+
5
+ .iconCol {
6
+ @apply flex flex-col w-6
7
+ }
8
+
9
+ .icon {
10
+ @apply text-light-green
11
+ }
12
+
13
+ .title {
14
+ @apply flex text-light-green font-bold w-full text-left
15
+ }
16
+
17
+ .textCol {
18
+ @apply flex flex-col text-white text-justify w-96
19
+ }
20
+
21
+ .detailSpace {
22
+ @apply w-6
23
+ }
@@ -0,0 +1,76 @@
1
+ import React from 'react'
2
+ export default function Logo ({ width, heigth }) {
3
+ return (
4
+ <svg
5
+ data-name='Layer 1'
6
+ xmlns='http://www.w3.org/2000/svg'
7
+ viewBox='0 0 2000 2000'
8
+ width={width}
9
+ height={heigth}
10
+ >
11
+ <path
12
+ d='M610.13 1336.34h1012v-.29c136.31-6.16 244.94-118.58 244.94-256.4 0-141.77-114.93-256.7-256.7-256.7a255.52 255.52 0 0 0-118.5 29c-42.1-97.31-127.47-171.53-231.86-198.36m-866.79 0C243.55 692.05 133 827.87 133 989.53s110.76 297.67 260.58 336'
13
+ style={{
14
+ strokeWidth: '67.96px',
15
+ stroke: '#FFFFFF',
16
+ fill: 'none',
17
+ strokeLinecap: 'round',
18
+ strokeLinejoin: 'round'
19
+ }}
20
+ />
21
+ <path
22
+ d='M661.56 916.05a322.34 322.34 0 0 0 164.19 44.64c178.89 0 323.91-145 323.91-323.92s-145-323.91-323.91-323.91-323.92 145-323.92 323.91v483.15'
23
+ style={{
24
+ stroke: '#21fa90',
25
+ strokeWidth: '67.96px',
26
+ fill: 'none',
27
+ strokeLinecap: 'round',
28
+ strokeLinejoin: 'round'
29
+ }}
30
+ />
31
+ <path
32
+ style={{
33
+ opacity: 0.2,
34
+ stroke: '#21fa90',
35
+ strokeWidth: '67.96px',
36
+ fill: 'none',
37
+ strokeLinecap: 'round',
38
+ strokeLinejoin: 'round'
39
+ }}
40
+ d='M501.83 1630.69v56.45'
41
+ />
42
+ <path
43
+ style={{
44
+ opacity: 0.4,
45
+ stroke: '#21fa90',
46
+ strokeWidth: '67.96px',
47
+ fill: 'none',
48
+ strokeLinecap: 'round',
49
+ strokeLinejoin: 'round'
50
+ }}
51
+ d='M502.33 1453.1v89.15'
52
+ />
53
+ <path
54
+ style={{
55
+ opacity: 0.7,
56
+ stroke: '#21fa90',
57
+ strokeWidth: '67.96px',
58
+ fill: 'none',
59
+ strokeLinecap: 'round',
60
+ strokeLinejoin: 'round'
61
+ }}
62
+ d='M501.83 1211.73v149.07'
63
+ />
64
+ <path
65
+ d='m793.55 866.39-135 47.43 59.44 126'
66
+ style={{
67
+ strokeWidth: '70.05px',
68
+ stroke: '#21fa90',
69
+ fill: 'none',
70
+ strokeLinecap: 'round',
71
+ strokeLinejoin: 'round'
72
+ }}
73
+ />
74
+ </svg>
75
+ )
76
+ }
@@ -1,40 +1,71 @@
1
- import React from 'react'
1
+ 'use strict'
2
+ import { faCheck } from '@fortawesome/free-solid-svg-icons'
3
+ import Button from '../components/Button'
2
4
 
3
- import { Button } from './Button'
4
-
5
- // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
5
  export default {
7
- title: 'Example/Button',
6
+ title: 'Platformatic/Button',
8
7
  component: Button,
9
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
10
8
  argTypes: {
11
- backgroundColor: { control: 'color' }
9
+ label: {
10
+ type: 'string',
11
+ control: 'text'
12
+ },
13
+ primary: {
14
+ type: 'boolean'
15
+ },
16
+ color: {
17
+ type: 'string',
18
+ control: {
19
+ type: 'radio',
20
+ options: ['green', 'red']
21
+ }
22
+ }
12
23
  }
13
24
  }
14
25
 
15
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
16
26
  const Template = (args) => <Button {...args} />
17
27
 
18
- export const Primary = Template.bind({})
28
+ export const PrimaryGreen = Template.bind({})
19
29
  // More on args: https://storybook.js.org/docs/react/writing-stories/args
20
- Primary.args = {
30
+ PrimaryGreen.args = {
21
31
  primary: true,
22
- label: 'Button'
32
+ label: 'Primary Green',
33
+ color: 'green'
23
34
  }
24
35
 
25
- export const Secondary = Template.bind({})
26
- Secondary.args = {
27
- label: 'Button'
36
+ export const SecondaryGreen = Template.bind({})
37
+ SecondaryGreen.args = {
38
+ primary: false,
39
+ label: 'Secondary Green',
40
+ color: 'green'
28
41
  }
29
42
 
30
- export const Large = Template.bind({})
31
- Large.args = {
32
- size: 'large',
33
- label: 'Button'
43
+ export const PrimaryWithIcon = Template.bind({})
44
+ PrimaryWithIcon.args = {
45
+ primary: true,
46
+ label: 'Primary with Icon',
47
+ icon: faCheck
48
+ }
49
+
50
+ export const SecondaryWithIcon = Template.bind({})
51
+ SecondaryWithIcon.args = {
52
+ primary: false,
53
+ label: 'Secondary with Icon',
54
+ icon: faCheck
55
+
56
+ }
57
+
58
+ export const PrimaryRed = Template.bind({})
59
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
60
+ PrimaryRed.args = {
61
+ primary: true,
62
+ label: 'Primary Red',
63
+ color: 'red'
34
64
  }
35
65
 
36
- export const Small = Template.bind({})
37
- Small.args = {
38
- size: 'small',
39
- label: 'Button'
66
+ export const SecondaryRed = Template.bind({})
67
+ SecondaryRed.args = {
68
+ primary: false,
69
+ label: 'Secondary Red',
70
+ color: 'red'
40
71
  }
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import FollowUs from '../components/FollowUs'
3
+
4
+ export default {
5
+ title: 'Platformatic/FollowUs',
6
+ component: FollowUs
7
+ }
8
+
9
+ const Template = (args) => <FollowUs {...args} />
10
+
11
+ export const FollowUsDefault = Template.bind({})
12
+ FollowUsDefault.args = {
13
+ label: 'Follow us on'
14
+ }
@@ -0,0 +1,42 @@
1
+
2
+ import React from 'react'
3
+ import FrontpageBackground from '../components/FrontpageBackground'
4
+ import TwoColumnsLayout from '../components/layouts/TwoColumnsLayout'
5
+ import Box from '../components/Box'
6
+ import GHLoginButton from '../components/GHLoginButton'
7
+ import Logo from '../components/Logo'
8
+ import List from '../components/List'
9
+ import ListElement from '../components/ListElement'
10
+ import HorizontalSeparator from '../components/HorizontalSeparator'
11
+ import FollowUs from '../components/FollowUs'
12
+
13
+ export default {
14
+ title: 'Platformatic/Frontpage'
15
+ }
16
+
17
+ const Template = (args) =>
18
+ <FrontpageBackground>
19
+
20
+ <TwoColumnsLayout>
21
+ <Box>
22
+ <Logo width={80} />
23
+ <List title='platformatic'>
24
+ <ListElement title='Instant edge deploy' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
25
+ <ListElement title='Collaborate with previews' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
26
+ <ListElement title='Turn static to dynamic' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
27
+ <ListElement title='Ship directly to the edge' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
28
+ </List>
29
+ <HorizontalSeparator />
30
+ <FollowUs />
31
+ </Box>
32
+ <Box>
33
+ <p className='text-5xl text-main-green font-bold mt-24 mb-16'>Join the best backend teams</p>
34
+ <GHLoginButton />
35
+ <p className='text-white my-8 w-80'> by clicking continue, you agree to our <a href="javascript:alert('todo')">Terms of Service</a> and <a href="javascript:alert('todo')">Privacy policy.</a> </p>
36
+ <HorizontalSeparator />
37
+ </Box>
38
+ </TwoColumnsLayout>
39
+ </FrontpageBackground>
40
+
41
+ export const Frontpage = Template.bind({})
42
+ Frontpage.args = {}
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import FrontpageBackground from '../components/FrontpageBackground'
3
+
4
+ export default {
5
+ title: 'Platformatic/FrontpageBackground',
6
+ component: FrontpageBackground
7
+ }
8
+
9
+ const Template = (args) =>
10
+ <FrontpageBackground>
11
+ <div className='grid h-screen place-items-center'>
12
+ <p className='text-main-green text-4xl'>Frontpage Background</p>
13
+ </div>
14
+ </FrontpageBackground>
15
+
16
+ export const FrontpageBackgroundDefault = Template.bind({})
17
+ FrontpageBackgroundDefault.args = {}
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+ import HorizontalSeparator from '../components/HorizontalSeparator'
3
+
4
+ export default {
5
+ title: 'Platformatic/HorizontalSeparator',
6
+ component: HorizontalSeparator
7
+ }
8
+
9
+ const Template = (args) => <HorizontalSeparator {...args} />
10
+
11
+ export const HorizontalSeparatorDefault = Template.bind({})
12
+ HorizontalSeparatorDefault.args = {}
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+ import Input from '../components/Input'
3
+ export default {
4
+ title: 'Platformatic/Input',
5
+ component: Input
6
+ }
7
+
8
+ const Template = (args) => <Input {...args} />
9
+
10
+ export const Default = Template.bind({})
11
+
12
+ Default.args = {
13
+ name: 'test',
14
+ placeholder: 'Platformatic'
15
+ }
@@ -0,0 +1,29 @@
1
+ import React from 'react'
2
+ import List from '../components/List'
3
+ import ListElement from '../components/ListElement'
4
+
5
+ export default {
6
+ title: 'Platformatic/List',
7
+ component: List
8
+ }
9
+
10
+ const Template = (args) => <List {...args} />
11
+ export const ListWithNoElements = Template.bind({})
12
+ ListWithNoElements.args = {
13
+ title: 'List Title'
14
+ }
15
+
16
+ const TemplateWithElements = (args) => (
17
+ <List {...args}>
18
+ <ListElement title='List Element 1' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
19
+ <ListElement title='List Element 2' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
20
+ </List>
21
+ )
22
+
23
+ export const ListWithElements = TemplateWithElements.bind({})
24
+ ListWithElements.args = {
25
+ title: 'List Title'
26
+ }
27
+
28
+ export const ListWithElementsNoTitle = TemplateWithElements.bind({})
29
+ ListWithElementsNoTitle.args = {}
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import ListElement from '../components/ListElement'
3
+
4
+ export default {
5
+ title: 'Platformatic/ListElement',
6
+ component: ListElement
7
+ }
8
+
9
+ const Template = (args) => <ListElement {...args} />
10
+
11
+ export const ListElementFull = Template.bind({})
12
+ ListElementFull.args = {
13
+ title: 'List Element Title',
14
+ detail: 'Lorem Ipsum dolor sit amet consectetur adipiscing elit. Qui enim potest, nisi quis potest, negare'
15
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import Logo from '../components/Logo'
3
+
4
+ export default {
5
+ title: 'Platformatic/Logo',
6
+ component: Logo
7
+ }
8
+
9
+ const Template = (args) => <Logo {...args} />
10
+ export const LogoSmall = Template.bind({})
11
+ LogoSmall.args = {
12
+ width: 300,
13
+ heigth: 300
14
+ }
package/vitest.config.js CHANGED
@@ -7,7 +7,7 @@ export default defineConfig({
7
7
  plugins: [react()],
8
8
  test: {
9
9
  globals: true,
10
- environment: 'jsdom',
10
+ environment: 'happy-dom',
11
11
  exclude: ['node_modules']
12
12
  }
13
13
 
@@ -1,50 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
- import './button.css'
4
-
5
- /**
6
- * Primary UI component for user interaction
7
- */
8
- export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
9
- const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary'
10
- return (
11
- <button
12
- type='button'
13
- className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
14
- style={backgroundColor && { backgroundColor }}
15
- {...props}
16
- >
17
- {label}
18
- </button>
19
- )
20
- }
21
-
22
- Button.propTypes = {
23
- /**
24
- * Is this the principal call to action on the page?
25
- */
26
- primary: PropTypes.bool,
27
- /**
28
- * What background color to use
29
- */
30
- backgroundColor: PropTypes.string,
31
- /**
32
- * How large should the button be?
33
- */
34
- size: PropTypes.oneOf(['small', 'medium', 'large']),
35
- /**
36
- * Button contents
37
- */
38
- label: PropTypes.string.isRequired,
39
- /**
40
- * Optional click handler
41
- */
42
- onClick: PropTypes.func
43
- }
44
-
45
- Button.defaultProps = {
46
- backgroundColor: null,
47
- primary: false,
48
- size: 'medium',
49
- onClick: undefined
50
- }
@@ -1,30 +0,0 @@
1
- .storybook-button {
2
- font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
3
- font-weight: 700;
4
- border: 0;
5
- border-radius: 3em;
6
- cursor: pointer;
7
- display: inline-block;
8
- line-height: 1;
9
- }
10
- .storybook-button--primary {
11
- color: white;
12
- background-color: #1ea7fd;
13
- }
14
- .storybook-button--secondary {
15
- color: #333;
16
- background-color: transparent;
17
- box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
18
- }
19
- .storybook-button--small {
20
- font-size: 12px;
21
- padding: 10px 16px;
22
- }
23
- .storybook-button--medium {
24
- font-size: 14px;
25
- padding: 11px 20px;
26
- }
27
- .storybook-button--large {
28
- font-size: 16px;
29
- padding: 12px 24px;
30
- }