willba-component-library 0.0.28 → 0.0.33
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.
- package/.storybook/main.ts +19 -19
- package/.storybook/preview.ts +15 -15
- package/lib/components/FilterBar/FilterBar.d.ts +2 -2
- package/lib/components/FilterBar/components/Callendar.d.ts +2 -0
- package/lib/components/FilterBar/components/Divider.d.ts +2 -0
- package/lib/components/FilterBar/components/SelectButton.d.ts +2 -0
- package/lib/components/FilterBar/components/SubmitButton.d.ts +2 -0
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +3 -0
- package/lib/components/FilterBar/components/categories/Categories.d.ts +3 -0
- package/lib/components/FilterBar/components/divider/Divider.d.ts +3 -0
- package/lib/components/FilterBar/components/guests/Guests.d.ts +3 -0
- package/lib/components/FilterBar/components/select-button/SelectButton.d.ts +3 -0
- package/lib/components/FilterBar/components/submit-button/SubmitButton.d.ts +3 -0
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +13 -0
- package/lib/index.esm.js +5695 -84
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5735 -106
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +5736 -107
- package/lib/index.umd.js.map +1 -1
- package/package.json +8 -6
- package/prettier.config.js +6 -0
- package/rollup.config.mjs +59 -59
- package/src/components/Button/Button.stories.tsx +34 -34
- package/src/components/Button/Button.tsx +56 -56
- package/src/components/Button/button.css +29 -29
- package/src/components/Button/index.ts +1 -1
- package/src/components/FilterBar/FilterBar.css +5 -99
- package/src/components/FilterBar/FilterBar.stories.tsx +20 -20
- package/src/components/FilterBar/FilterBar.tsx +28 -140
- package/src/components/FilterBar/components/calendar/Calendar.css +0 -0
- package/src/components/FilterBar/components/calendar/Calendar.tsx +41 -0
- package/src/components/FilterBar/components/categories/Categories.css +15 -0
- package/src/components/FilterBar/components/categories/Categories.tsx +37 -0
- package/src/components/FilterBar/components/divider/Divider.css +6 -0
- package/src/components/FilterBar/components/divider/Divider.tsx +7 -0
- package/src/components/FilterBar/components/guests/Guests.css +44 -0
- package/src/components/FilterBar/components/guests/Guests.tsx +42 -0
- package/src/components/FilterBar/components/select-button/SelectButton.css +9 -0
- package/src/components/FilterBar/components/select-button/SelectButton.tsx +11 -0
- package/src/components/FilterBar/components/submit-button/SubmitButton.css +11 -0
- package/src/components/FilterBar/components/submit-button/SubmitButton.tsx +11 -0
- package/src/components/FilterBar/hooks/useFilterBar.tsx +49 -0
- package/src/components/FilterBar/index.ts +1 -1
- package/src/index.ts +4 -4
- package/stories/Button.stories.ts +50 -50
- package/stories/Button.tsx +48 -48
- package/stories/Configure.mdx +364 -364
- package/stories/Header.stories.ts +27 -27
- package/stories/Header.tsx +56 -56
- package/stories/Page.stories.ts +29 -29
- package/stories/Page.tsx +73 -73
- package/stories/assets/accessibility.svg +4 -4
- package/stories/assets/discord.svg +15 -15
- package/stories/assets/github.svg +3 -3
- package/stories/assets/tutorials.svg +12 -12
- package/stories/assets/youtube.svg +4 -4
- package/stories/button.css +30 -30
- package/stories/header.css +32 -32
- package/stories/page.css +69 -69
- package/tsconfig.json +22 -22
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import "./FilterBar.css";
|
|
1
|
+
import React, { useState } from 'react'
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const [categories, setCategories] = useState(0);
|
|
11
|
-
|
|
12
|
-
const handleSelectedFilter = (id: any) => {
|
|
13
|
-
setSelectedFilter(id);
|
|
14
|
-
};
|
|
3
|
+
import Divider from './components/divider/Divider'
|
|
4
|
+
import SelectButton from './components/select-button/SelectButton'
|
|
5
|
+
import SubmitButton from './components/submit-button/SubmitButton'
|
|
6
|
+
import Calendar from './components/calendar/Calendar'
|
|
7
|
+
import Guests from './components/guests/Guests'
|
|
8
|
+
import Categories from './components/categories/Categories'
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
const queryParams = new URLSearchParams();
|
|
10
|
+
import useFilterBar from './hooks/useFilterBar'
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
// startDate,
|
|
21
|
-
// endDate,
|
|
22
|
-
guestsAdults,
|
|
23
|
-
guestsKids,
|
|
24
|
-
categories,
|
|
25
|
-
};
|
|
12
|
+
import './FilterBar.css'
|
|
26
13
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
export default function FilterBar() {
|
|
15
|
+
const {
|
|
16
|
+
selectedFilter,
|
|
17
|
+
guestsAdults,
|
|
18
|
+
guestsKids,
|
|
19
|
+
categories,
|
|
20
|
+
setSelectedFilter,
|
|
21
|
+
setGuestsAdults,
|
|
22
|
+
setGuestsKids,
|
|
23
|
+
setCategories,
|
|
24
|
+
handleSelectedFilter,
|
|
25
|
+
handleSubmit,
|
|
26
|
+
} = useFilterBar()
|
|
37
27
|
|
|
38
28
|
return (
|
|
39
|
-
<div className="
|
|
40
|
-
<div className="
|
|
29
|
+
<div className="filter-bar">
|
|
30
|
+
<div className="filter-bar-header">
|
|
41
31
|
<SelectButton
|
|
42
32
|
label="Start date"
|
|
43
33
|
onClick={() => handleSelectedFilter(1)}
|
|
@@ -58,9 +48,9 @@ export default function FilterBar() {
|
|
|
58
48
|
</div>
|
|
59
49
|
|
|
60
50
|
{selectedFilter && (
|
|
61
|
-
<div className="
|
|
62
|
-
{selectedFilter === 1 && <
|
|
63
|
-
{selectedFilter === 2 && <
|
|
51
|
+
<div className="filter-bar-container">
|
|
52
|
+
{selectedFilter === 1 && <Calendar />}
|
|
53
|
+
{selectedFilter === 2 && <Calendar />}
|
|
64
54
|
{selectedFilter === 3 && (
|
|
65
55
|
<Guests
|
|
66
56
|
guestsAdults={guestsAdults}
|
|
@@ -77,107 +67,5 @@ export default function FilterBar() {
|
|
|
77
67
|
</div>
|
|
78
68
|
)}
|
|
79
69
|
</div>
|
|
80
|
-
)
|
|
70
|
+
)
|
|
81
71
|
}
|
|
82
|
-
|
|
83
|
-
const Divider = () => {
|
|
84
|
-
return <div className="search-widget-divider" />;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const SubmitButton = ({ onClick }: any) => {
|
|
88
|
-
return (
|
|
89
|
-
<button className="search-widget-submit-button" onClick={onClick}>
|
|
90
|
-
Apply filters
|
|
91
|
-
</button>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const SelectButton = ({ label, onClick }: any) => {
|
|
96
|
-
return (
|
|
97
|
-
<button className="search-widget-select-button" onClick={onClick}>
|
|
98
|
-
{label}
|
|
99
|
-
</button>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const StartDate = () => {
|
|
104
|
-
return <div>Start date</div>;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const EndDate = () => {
|
|
108
|
-
return <div>End date</div>;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const Guests = ({
|
|
112
|
-
guestsAdults,
|
|
113
|
-
guestsKids,
|
|
114
|
-
decrementAdults,
|
|
115
|
-
incrementAdults,
|
|
116
|
-
decrementKids,
|
|
117
|
-
incrementKids,
|
|
118
|
-
}: any) => {
|
|
119
|
-
return (
|
|
120
|
-
<div className="search-widget-guests">
|
|
121
|
-
<h3>Guests</h3>
|
|
122
|
-
<p>Who's coming?</p>
|
|
123
|
-
|
|
124
|
-
<div className="guests-filter-container">
|
|
125
|
-
<div className="guests-filter-inner">
|
|
126
|
-
<span>Adults</span>
|
|
127
|
-
<div>
|
|
128
|
-
<button onClick={decrementAdults} disabled={guestsAdults < 1}>
|
|
129
|
-
-
|
|
130
|
-
</button>
|
|
131
|
-
<span>{guestsAdults}</span>
|
|
132
|
-
<button onClick={incrementAdults}>+</button>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
<div className="guests-filter-inner">
|
|
136
|
-
<span>Kids</span>
|
|
137
|
-
<div>
|
|
138
|
-
<button onClick={decrementKids} disabled={guestsKids < 1}>
|
|
139
|
-
-
|
|
140
|
-
</button>
|
|
141
|
-
<span>{guestsKids}</span>
|
|
142
|
-
<button onClick={incrementKids}>+</button>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const Categories = ({ categories, setCategories }: any) => {
|
|
151
|
-
const categoriesPlaceholder = [
|
|
152
|
-
"Weekend",
|
|
153
|
-
"Week",
|
|
154
|
-
"Summer camp",
|
|
155
|
-
"Winter camp",
|
|
156
|
-
];
|
|
157
|
-
|
|
158
|
-
const [selectedCategory, setSelectedCategory] = useState("");
|
|
159
|
-
|
|
160
|
-
const handleCategoryChange = (selectedCategory: any) => {
|
|
161
|
-
setSelectedCategory(selectedCategory);
|
|
162
|
-
setCategories(selectedCategory); // Update the parent component's state with the selected category
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<div className="search-widget-categories">
|
|
167
|
-
<h3>CATEGORY</h3>
|
|
168
|
-
<div className="categories-filter-inner">
|
|
169
|
-
{categoriesPlaceholder.map((itm, idx) => (
|
|
170
|
-
<div key={idx}>
|
|
171
|
-
<input
|
|
172
|
-
type="radio"
|
|
173
|
-
value={itm}
|
|
174
|
-
checked={selectedCategory === itm}
|
|
175
|
-
onChange={() => handleCategoryChange(itm)}
|
|
176
|
-
/>
|
|
177
|
-
<span>{itm}</span>
|
|
178
|
-
</div>
|
|
179
|
-
))}
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
);
|
|
183
|
-
};
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { addDays, format } from "date-fns";
|
|
4
|
+
import { DateRange, DayPicker } from "react-day-picker";
|
|
5
|
+
|
|
6
|
+
import "react-day-picker/dist/style.css";
|
|
7
|
+
|
|
8
|
+
const pastMonth = new Date(2020, 10, 15);
|
|
9
|
+
|
|
10
|
+
export default function Calendar() {
|
|
11
|
+
const defaultSelected: DateRange = {
|
|
12
|
+
from: pastMonth,
|
|
13
|
+
to: addDays(pastMonth, 4),
|
|
14
|
+
};
|
|
15
|
+
const [range, setRange] = useState<DateRange | undefined>(defaultSelected);
|
|
16
|
+
|
|
17
|
+
let footer = <p>Please pick the first day.</p>;
|
|
18
|
+
if (range?.from) {
|
|
19
|
+
if (!range.to) {
|
|
20
|
+
footer = <p>{format(range.from, "PPP")}</p>;
|
|
21
|
+
} else if (range.to) {
|
|
22
|
+
footer = (
|
|
23
|
+
<p>
|
|
24
|
+
{format(range.from, "PPP")}–{format(range.to, "PPP")}
|
|
25
|
+
</p>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<DayPicker
|
|
32
|
+
id="test"
|
|
33
|
+
mode="range"
|
|
34
|
+
numberOfMonths={2}
|
|
35
|
+
defaultMonth={pastMonth}
|
|
36
|
+
selected={range}
|
|
37
|
+
footer={footer}
|
|
38
|
+
onSelect={setRange}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.filter-bar-categories {
|
|
2
|
+
text-align: center;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.categories-filter-inner {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
gap: 20px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.categories-filter-inner input {
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
margin-right: 10px;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import './Categories.css'
|
|
3
|
+
|
|
4
|
+
export default function Categories({ categories, setCategories }: any) {
|
|
5
|
+
const categoriesPlaceholder = [
|
|
6
|
+
'Weekend',
|
|
7
|
+
'Week',
|
|
8
|
+
'Summer camp',
|
|
9
|
+
'Winter camp',
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const [selectedCategory, setSelectedCategory] = useState('')
|
|
13
|
+
|
|
14
|
+
const handleCategoryChange = (selectedCategory: any) => {
|
|
15
|
+
setSelectedCategory(selectedCategory)
|
|
16
|
+
setCategories(selectedCategory)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="filter-bar-categories">
|
|
21
|
+
<h3>CATEGORY</h3>
|
|
22
|
+
<div className="categories-filter-inner">
|
|
23
|
+
{categoriesPlaceholder.map((itm, idx) => (
|
|
24
|
+
<div key={idx}>
|
|
25
|
+
<input
|
|
26
|
+
type="radio"
|
|
27
|
+
value={itm}
|
|
28
|
+
checked={selectedCategory === itm}
|
|
29
|
+
onChange={() => handleCategoryChange(itm)}
|
|
30
|
+
/>
|
|
31
|
+
<span>{itm}</span>
|
|
32
|
+
</div>
|
|
33
|
+
))}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.filter-bar-guests {
|
|
2
|
+
text-align: initial;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.guests-filter-container {
|
|
6
|
+
display: flex;
|
|
7
|
+
margin-top: 30px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.guests-filter-inner {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.guests-filter-inner:not(:last-child) {
|
|
16
|
+
margin-right: 50px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.guests-filter-inner > span {
|
|
20
|
+
display: block;
|
|
21
|
+
margin-right: 20px;
|
|
22
|
+
font-weight: bold;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.guests-filter-inner > div {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.guests-filter-inner > div > span {
|
|
31
|
+
margin: 0 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.guests-filter-inner > div button {
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
border: none;
|
|
37
|
+
background-color: #CDEEFF;
|
|
38
|
+
width: 25px;
|
|
39
|
+
height: 25px;
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
align-items: center;
|
|
43
|
+
font-size: 20px;
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import './Guests.css'
|
|
4
|
+
|
|
5
|
+
export default function Guests({
|
|
6
|
+
guestsAdults,
|
|
7
|
+
guestsKids,
|
|
8
|
+
decrementAdults,
|
|
9
|
+
incrementAdults,
|
|
10
|
+
decrementKids,
|
|
11
|
+
incrementKids,
|
|
12
|
+
}: any) {
|
|
13
|
+
return (
|
|
14
|
+
<div className="search-widget-guests">
|
|
15
|
+
<h3>Guests</h3>
|
|
16
|
+
<p>Who's coming?</p>
|
|
17
|
+
|
|
18
|
+
<div className="guests-filter-container">
|
|
19
|
+
<div className="guests-filter-inner">
|
|
20
|
+
<span>Adults</span>
|
|
21
|
+
<div>
|
|
22
|
+
<button onClick={decrementAdults} disabled={guestsAdults < 1}>
|
|
23
|
+
-
|
|
24
|
+
</button>
|
|
25
|
+
<span>{guestsAdults}</span>
|
|
26
|
+
<button onClick={incrementAdults}>+</button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div className="guests-filter-inner">
|
|
30
|
+
<span>Kids</span>
|
|
31
|
+
<div>
|
|
32
|
+
<button onClick={decrementKids} disabled={guestsKids < 1}>
|
|
33
|
+
-
|
|
34
|
+
</button>
|
|
35
|
+
<span>{guestsKids}</span>
|
|
36
|
+
<button onClick={incrementKids}>+</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
export default function useFilterBar() {
|
|
4
|
+
const [selectedFilter, setSelectedFilter] = useState<number | boolean>(false)
|
|
5
|
+
// const [startDate, setStartDate] = useState(0);
|
|
6
|
+
// const [endDate, setEndDate] = useState(0);
|
|
7
|
+
const [guestsAdults, setGuestsAdults] = useState(1)
|
|
8
|
+
const [guestsKids, setGuestsKids] = useState(0)
|
|
9
|
+
const [categories, setCategories] = useState(0)
|
|
10
|
+
|
|
11
|
+
const handleSelectedFilter = (id: any) => {
|
|
12
|
+
setSelectedFilter(id)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const handleSubmit = () => {
|
|
16
|
+
const queryParams = new URLSearchParams()
|
|
17
|
+
|
|
18
|
+
const params = {
|
|
19
|
+
// startDate,
|
|
20
|
+
// endDate,
|
|
21
|
+
guestsAdults,
|
|
22
|
+
guestsKids,
|
|
23
|
+
categories,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const [key, value] of Object.entries(params)) {
|
|
27
|
+
if (value) {
|
|
28
|
+
queryParams.append(key, value.toString())
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const url = `http://localhost:4000/en/events/?${queryParams.toString()}`
|
|
33
|
+
window.location.href = url
|
|
34
|
+
handleSelectedFilter(false)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
selectedFilter,
|
|
39
|
+
guestsAdults,
|
|
40
|
+
guestsKids,
|
|
41
|
+
categories,
|
|
42
|
+
setSelectedFilter,
|
|
43
|
+
setGuestsAdults,
|
|
44
|
+
setGuestsKids,
|
|
45
|
+
setCategories,
|
|
46
|
+
handleSelectedFilter,
|
|
47
|
+
handleSubmit,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./FilterBar";
|
|
1
|
+
export { default } from "./FilterBar";
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Button from "./components/Button";
|
|
2
|
-
import FilterBar from "./components/FilterBar";
|
|
3
|
-
|
|
4
|
-
export { Button, FilterBar };
|
|
1
|
+
import Button from "./components/Button";
|
|
2
|
+
import FilterBar from "./components/FilterBar";
|
|
3
|
+
|
|
4
|
+
export { Button, FilterBar };
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
6
|
-
const meta = {
|
|
7
|
-
title: 'Example/Button',
|
|
8
|
-
component: Button,
|
|
9
|
-
parameters: {
|
|
10
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
11
|
-
layout: 'centered',
|
|
12
|
-
},
|
|
13
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
16
|
-
argTypes: {
|
|
17
|
-
backgroundColor: { control: 'color' },
|
|
18
|
-
},
|
|
19
|
-
} satisfies Meta<typeof Button>;
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof meta>;
|
|
23
|
-
|
|
24
|
-
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
25
|
-
export const Primary: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
primary: true,
|
|
28
|
-
label: 'Button',
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const Secondary: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
label: 'Button',
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Large: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
size: 'large',
|
|
41
|
-
label: 'Button',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const Small: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
size: 'small',
|
|
48
|
-
label: 'Button',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Example/Button',
|
|
8
|
+
component: Button,
|
|
9
|
+
parameters: {
|
|
10
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
16
|
+
argTypes: {
|
|
17
|
+
backgroundColor: { control: 'color' },
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof Button>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
25
|
+
export const Primary: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
primary: true,
|
|
28
|
+
label: 'Button',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Secondary: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
label: 'Button',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Large: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
size: 'large',
|
|
41
|
+
label: 'Button',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Small: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
size: 'small',
|
|
48
|
+
label: 'Button',
|
|
49
|
+
},
|
|
50
|
+
};
|