boottent-design 0.1.66 → 0.1.67
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/README.md +154 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,63 @@
|
|
|
1
1
|
# boottent-design
|
|
2
2
|
|
|
3
|
-
React, Vite, Typescript, TailwindCSS,
|
|
3
|
+
React, Vite, Typescript, TailwindCSS, Radix-UI를 사용해 만든 부트텐트 디자인시스템 라이브러리입니다.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
yarn add boottent-design@0.1.
|
|
8
|
+
yarn add boottent-design@0.1.67
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Usage Example
|
|
11
|
+
## Usage Example: Icon, Symbols, Input, Button, Stack, Box, FlexBox
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
```tsx
|
|
14
|
+
import { Input, Icon, Symbols } from "boottent-design/ui";
|
|
15
|
+
import { FlexBox } from "boottent-design/layout";
|
|
16
|
+
import { cn } from "boottent-design/utils";
|
|
17
|
+
import { colors } from "boottent-design/styles";
|
|
18
|
+
|
|
19
|
+
export default function Test() {
|
|
20
|
+
return (
|
|
21
|
+
<FlexBox.Col className="bg-grey-100 min-h-60 w-full items-center gap-4 rounded-lg p-10">
|
|
22
|
+
<Input className={cn("w-full min-w-[500px]")} placeholder="입력해주세요." />
|
|
23
|
+
<FlexBox.Row className="mx-auto w-full items-center justify-center gap-4 p-4">
|
|
24
|
+
<Icon.Calendar fill={colors.lime[500]} />
|
|
25
|
+
<Symbols.Boottent />
|
|
26
|
+
<Symbols.Apple />
|
|
27
|
+
</FlexBox.Row>
|
|
28
|
+
</FlexBox.Col>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage Example 2 : Modal, Alert, Dialog, Toast
|
|
34
|
+
|
|
35
|
+
usePortal 훅을 사용하여 모달, 다이얼로그, 토스트, 알람 창을 띄우려면 PortalProvider를 앱의 루트에 추가해주세요.
|
|
14
36
|
|
|
15
37
|
```tsx
|
|
16
|
-
import {
|
|
38
|
+
import { PortalProvider } from "boottent-design/provider";
|
|
39
|
+
|
|
40
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
41
|
+
<>
|
|
42
|
+
<App />
|
|
43
|
+
<PortalProvider />
|
|
44
|
+
</>,
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
모달, 알람창, 다이얼로그, 토스트를 사용하는 예시입니다.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { Button } from "boottent-design/ui";
|
|
17
52
|
import { Box, Stack } from "boottent-design/layout";
|
|
18
53
|
import { cn } from "boottent-design/utils";
|
|
19
|
-
import { colors } from "boottent-design/styles";
|
|
20
54
|
import { usePortal } from "boottent-design/hooks";
|
|
21
55
|
|
|
22
56
|
export default function Test() {
|
|
23
57
|
const { toast, modal, alert, dialog } = usePortal();
|
|
24
58
|
|
|
25
59
|
return (
|
|
26
|
-
<Stack className="min-h-60 w-full items-center gap-4 rounded-lg
|
|
60
|
+
<Stack className="bg-grey-100 min-h-60 w-full items-center gap-4 rounded-lg p-10">
|
|
27
61
|
<Box className="flex gap-4">
|
|
28
62
|
<Button
|
|
29
63
|
variant={"outline"}
|
|
@@ -88,29 +122,124 @@ export default function Test() {
|
|
|
88
122
|
알림
|
|
89
123
|
</Button>
|
|
90
124
|
</Box>
|
|
91
|
-
<Input className={cn("w-full min-w-[500px]")} placeholder="sdfasdf" />
|
|
92
|
-
<Stack
|
|
93
|
-
type="row"
|
|
94
|
-
className="mx-auto w-full items-center justify-center gap-4 p-4"
|
|
95
|
-
>
|
|
96
|
-
<Icon.Calendar fill={colors.lime[500]} />
|
|
97
|
-
<Symbols.Boottent />
|
|
98
|
-
<Symbols.Apple />
|
|
99
|
-
</Stack>
|
|
100
125
|
</Stack>
|
|
101
126
|
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Usage Example 3: Dropdown
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { useEffect, useState } from "react";
|
|
134
|
+
import { Dropdown, Icon, Button } from "boottent-design/ui";
|
|
135
|
+
import { Box } from "boottent-design/layout";
|
|
136
|
+
import { SelectedDropdownItem } from "boottent-design/types";
|
|
137
|
+
import { getDropdownButtonText } from "boottent-design/utils";
|
|
138
|
+
|
|
139
|
+
const Template = ({ defaultValue }: { defaultValue?: SelectedDropdownItem[] }) => {
|
|
140
|
+
const [selectedItems, setSelectedItems] = useState<SelectedDropdownItem[]>(defaultValue || []);
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
console.log("Selected Items:", selectedItems);
|
|
144
|
+
}, [selectedItems]);
|
|
145
|
+
|
|
146
|
+
// Dropdown의 size 설정
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<Box className="w-full space-y-8 py-10">
|
|
150
|
+
<Dropdown {...args} onChange={setSelectedItems}>
|
|
151
|
+
<Button
|
|
152
|
+
size="sm"
|
|
153
|
+
variant="outline"
|
|
154
|
+
theme="secondary"
|
|
155
|
+
icRight={<Icon.ArrowDown size="12" />}
|
|
156
|
+
className="text-medium14 min-w-fit justify-between"
|
|
157
|
+
>
|
|
158
|
+
{getDropdownButtonText(selectedItems, "Open Dropdown")}
|
|
159
|
+
</Button>
|
|
160
|
+
</Dropdown>
|
|
161
|
+
</Box>
|
|
162
|
+
);
|
|
102
163
|
};
|
|
103
164
|
```
|
|
104
165
|
|
|
105
|
-
|
|
166
|
+
## Usage Example 3 : ToggleButtonGroup
|
|
106
167
|
|
|
107
168
|
```tsx
|
|
108
|
-
import {
|
|
169
|
+
import { useState } from "react";
|
|
170
|
+
import { FlexBox, Box } from "boottent-design/layout";
|
|
171
|
+
import { ToggleButtonGroup } from "boottent-design/ui";
|
|
109
172
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
173
|
+
export const TooltipExamples = () => {
|
|
174
|
+
const [value, setValue] = useState<string>("option1");
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<FlexBox.Col className="items-center gap-4">
|
|
178
|
+
<h3>Single Toggle with Tooltip</h3>
|
|
179
|
+
<ToggleButtonGroup.Single
|
|
180
|
+
theme="primary"
|
|
181
|
+
size="md"
|
|
182
|
+
shape="square"
|
|
183
|
+
variant="outline"
|
|
184
|
+
value={value}
|
|
185
|
+
onChange={setValue}
|
|
186
|
+
options={[
|
|
187
|
+
{
|
|
188
|
+
value: "option1",
|
|
189
|
+
label: "Option 1",
|
|
190
|
+
tooltip: { label: "Tooltip for Option 1", position: "bottom-left", bubbleTip: false },
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
value: "option2",
|
|
194
|
+
label: "Option 2",
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
value: "option3",
|
|
198
|
+
label: "Option 3",
|
|
199
|
+
},
|
|
200
|
+
]}
|
|
201
|
+
/>
|
|
202
|
+
<Box className="mt-2 text-sm text-gray-600">선택된 옵션: {value}</Box>
|
|
203
|
+
</FlexBox.Col>
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Usage Example 4 : Tooltip
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
import { Tooltip, Button } from "boottent-design/ui";
|
|
212
|
+
import { FlexBox } from "boottent-design/layout";
|
|
213
|
+
|
|
214
|
+
export const Tooltip = () => {
|
|
215
|
+
const variants = [
|
|
216
|
+
{
|
|
217
|
+
variant: "primary",
|
|
218
|
+
text: "Primary Tooltip",
|
|
219
|
+
label: "This is a primary tooltip!",
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
variant: "secondary",
|
|
223
|
+
text: "Secondary Tooltip",
|
|
224
|
+
label: "This is a secondary tooltip!",
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
variant: "white",
|
|
228
|
+
text: "White Tooltip",
|
|
229
|
+
label: "This is a white tooltip!",
|
|
230
|
+
},
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<FlexBox.Col className="justify-center gap-10 py-40">
|
|
235
|
+
{variants.map(({ variant, text, label }) => (
|
|
236
|
+
<Tooltip key={variant} variant={variant} label={label} bubbleTip={false}>
|
|
237
|
+
<Button theme={"primary"} variant="outline">
|
|
238
|
+
{text}
|
|
239
|
+
</Button>
|
|
240
|
+
</Tooltip>
|
|
241
|
+
))}
|
|
242
|
+
</FlexBox.Col>
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
```
|