Skip to content

Commit b254677

Browse files
author
Daniel Vianna
committed
not clean
1 parent cc2bc77 commit b254677

13 files changed

+21689
-15569
lines changed

.storybook/main.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ module.exports = {
44
],
55
"addons": [
66
"@storybook/addon-links",
7-
"@storybook/addon-essentials"
7+
"@storybook/addon-essentials",
8+
'storybook-addon-designs',
89
]
9-
}
10+
}
11+

.storybook/manager-head.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<style>
33

44

5-
.css-1jj07fx * {
6-
font-size: 1rem;
5+
.css-21d5zu span:first-of-type * {
6+
color: white;
77
}
88

99

.storybook/manager.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import storybooktheme from './storybooktheme';
55

66
addons.setConfig({
77
theme: storybooktheme,
8-
// panelPosition: right,
98
sidebar: {
109
showRoots: false,
1110
collapsedRoots: ['other'],

.storybook/preview.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { addParameters } from '@storybook/react'
2+
13
export const parameters = {
24
actions: { argTypesRegex: "^on[A-Z].*" },
35
layout: 'centered',
@@ -10,4 +12,9 @@ export const parameters = {
1012
date: /Date$/,
1113
},
1214
},
13-
}
15+
}
16+
17+
addParameters({
18+
viewMode: 'story',
19+
docs: { page: null },
20+
})

build-storybook.log

+2,557
Large diffs are not rendered by default.

components/.DS_Store

0 Bytes
Binary file not shown.
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { ComponentStory, ComponentMeta } from '@storybook/react';
3+
4+
import { Buttonx } from './Buttonx';
5+
6+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7+
export default {
8+
title: 'Example/Buttonx',
9+
component: Buttonx,
10+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11+
argTypes: {
12+
backgroundColor: { control: 'color' },
13+
},
14+
} as ComponentMeta<typeof Buttonx>;
15+
16+
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
17+
const Template: ComponentStory<typeof Buttonx> = (args) => <Buttonx {...args} />;
18+
19+
export const Primary = Template.bind({});
20+
// More on args: https://storybook.js.org/docs/react/writing-stories/args
21+
Primary.args = {
22+
primary: true,
23+
label: 'Buttonx',
24+
};
25+
26+
export const Secondary = Template.bind({});
27+
Secondary.args = {
28+
label: 'Buttonx',
29+
};
30+
31+
export const Large = Template.bind({});
32+
Large.args = {
33+
size: 'large',
34+
label: 'Buttonx',
35+
};
36+
37+
export const Small = Template.bind({});
38+
Small.args = {
39+
size: 'small',
40+
label: 'Buttonx',
41+
};

components/button2/Buttonx.tsx

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from 'react';
2+
import './buttonx.css';
3+
4+
interface ButtonxProps {
5+
/**
6+
* Is this the principal call to action on the page?
7+
*/
8+
primary?: boolean;
9+
/**
10+
* What background color to use
11+
*/
12+
backgroundColor?: string;
13+
/**
14+
* How large should the button be?
15+
*/
16+
size?: 'small' | 'medium' | 'large';
17+
/**
18+
* Button contents
19+
*/
20+
label: string;
21+
/**
22+
* Optional click handler
23+
*/
24+
onClick?: () => void;
25+
}
26+
27+
/**
28+
* Primary UI component for user interaction
29+
*/
30+
export const Buttonx = ({
31+
primary = false,
32+
size = 'medium',
33+
backgroundColor,
34+
label,
35+
...props
36+
}: ButtonxProps) => {
37+
const mode = primary ? 'storybook-buttonx--primary' : 'storybook-buttonx--secondary';
38+
return (
39+
<button
40+
type="button"
41+
className={['storybook-buttonx', `storybook-buttonx--${size}`, mode].join(' ')}
42+
style={{ backgroundColor }}
43+
{...props}
44+
>
45+
{label}
46+
</button>
47+
);
48+
};

components/button2/buttonx.css

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.storybook-buttonx {
2+
font-family: 'system', '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-buttonx--primary {
11+
color: white;
12+
background-color: #1ea7fd;
13+
}
14+
.storybook-buttonx--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-buttonx--small {
20+
font-size: 12px;
21+
padding: 10px 16px;
22+
}
23+
.storybook-buttonx--medium {
24+
font-size: 14px;
25+
padding: 11px 20px;
26+
}
27+
.storybook-buttonx--large {
28+
font-size: 16px;
29+
padding: 12px 24px;
30+
}

0 commit comments

Comments
 (0)