@jk-core/components 1.1.17 → 1.1.19
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 +73 -73
- package/dist/index.js +1299 -997
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +8 -8
- package/dist/index.umd.cjs.map +1 -1
- package/dist/src/common/Carousel/index.d.ts +15 -0
- package/dist/src/common/RollingBanner/index.d.ts +11 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/utils/ts/formatMoney.d.ts +1 -1
- package/package.json +99 -99
- package/src/Calendar/Calendar.module.scss +213 -213
- package/src/Calendar/RangeCalendar.tsx +125 -125
- package/src/Calendar/ScrollCalendar.module.scss +214 -214
- package/src/Calendar/ScrollCalendar.tsx +124 -124
- package/src/Calendar/SingleCalendar.tsx +121 -121
- package/src/Calendar/components/DateLabel/DateLabel.module.scss +89 -89
- package/src/Calendar/components/DateLabel/index.tsx +91 -91
- package/src/Calendar/components/DayTile/DayTile.module.scss +117 -117
- package/src/Calendar/components/DayTile/index.tsx +108 -108
- package/src/Calendar/components/MonthTile/MonthTile.module.scss +59 -59
- package/src/Calendar/components/MonthTile/index.tsx +50 -50
- package/src/Calendar/components/ViewSelector/ViewSelector.module.scss +48 -48
- package/src/Calendar/components/ViewSelector/index.tsx +49 -49
- package/src/Calendar/components/YearTile/YearTile.module.scss +85 -85
- package/src/Calendar/components/YearTile/index.tsx +65 -65
- package/src/Calendar/hooks/useCalendarNav.ts +83 -83
- package/src/Calendar/hooks/useDateSelect.ts +54 -54
- package/src/Calendar/index.scss +189 -189
- package/src/Calendar/index.tsx +66 -66
- package/src/Calendar/type.ts +3 -3
- package/src/Calendar/utils/getWeeksInMonth.ts +45 -45
- package/src/Calendar/utils/isInRange.ts +8 -8
- package/src/Calendar/utils/isSameDay.ts +21 -21
- package/src/assets/arrow.svg +11 -11
- package/src/assets/close.svg +15 -15
- package/src/assets/drop-arrow.svg +3 -3
- package/src/common/Accordion/Accordion.module.scss +53 -53
- package/src/common/Accordion/arrow-down.svg +3 -3
- package/src/common/Accordion/arrow-up.svg +3 -3
- package/src/common/Accordion/index.tsx +54 -54
- package/src/common/Breadcrumbs/Breadcrumbs.module.scss +46 -46
- package/src/common/Breadcrumbs/home.svg +5 -5
- package/src/common/Breadcrumbs/index.tsx +82 -82
- package/src/common/Button/Button.module.scss +127 -127
- package/src/common/Button/index.tsx +60 -60
- package/src/common/Card/Card.module.scss +28 -28
- package/src/common/Card/index.tsx +19 -19
- package/src/common/Carousel/Carousel.module.scss +222 -0
- package/src/common/Carousel/index.tsx +411 -0
- package/src/common/Divider/Divider.module.scss +101 -101
- package/src/common/Divider/index.tsx +24 -24
- package/src/common/DropDown/DropDown.module.scss +135 -135
- package/src/common/DropDown/List.tsx +156 -156
- package/src/common/DropDown/arrow-down.svg +3 -3
- package/src/common/DropDown/index.tsx +108 -108
- package/src/common/DropDown/search.svg +4 -4
- package/src/common/Pagination/Pagination.module.scss +210 -210
- package/src/common/Pagination/arrow-left.svg +11 -11
- package/src/common/Pagination/arrow-right.svg +11 -11
- package/src/common/Pagination/index.tsx +156 -156
- package/src/common/RollingBanner/RollingBanner.module.scss +126 -0
- package/src/common/RollingBanner/index.tsx +140 -0
- package/src/common/SegmentButton/SegmentButton.module.scss +46 -45
- package/src/common/SegmentButton/index.tsx +79 -79
- package/src/common/Skeleton/Skeleton.module.scss +80 -80
- package/src/common/Skeleton/index.tsx +47 -47
- package/src/common/SwitchButton/SwitchButton.module.scss +65 -65
- package/src/common/SwitchButton/index.tsx +57 -57
- package/src/common/Table/Table.module.scss +70 -70
- package/src/common/Table/index.tsx +128 -128
- package/src/index.scss +1 -1
- package/src/index.tsx +24 -22
- package/src/styles/color.scss +346 -346
- package/src/styles/font-face.scss +18 -18
- package/src/styles/font.scss +49 -49
- package/src/styles/mediaQuery.scss +22 -22
- package/src/styles/scrollbar.scss +71 -71
- package/src/svg.d.ts +6 -6
- package/src/utils/styles/mediaQuery.scss +22 -22
- package/src/utils/ts/allowDecimal.ts +4 -4
- package/src/utils/ts/autoHypen.ts +33 -33
- package/src/utils/ts/calculateMax.ts +24 -24
- package/src/utils/ts/checkIsMobilePlatform.ts +15 -15
- package/src/utils/ts/formatFileSize.ts +16 -16
- package/src/utils/ts/formatMoney.ts +16 -16
- package/src/utils/ts/gradientRatio.ts +61 -61
- package/src/utils/ts/kiloToMega.ts +30 -30
- package/src/utils/ts/maskingPhone.ts +8 -8
- package/src/utils/ts/toQueryString.ts +7 -7
- package/src/utils/ts/valueAsNumber.ts +15 -15
- package/src/vite-env.d.ts +2 -2
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
.segment {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: grid;
|
|
4
|
-
width: fit-content;
|
|
5
|
-
background-color: var(--G-10);
|
|
6
|
-
border-radius: 8px;
|
|
7
|
-
z-index: 0;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
font-size: 1em;
|
|
10
|
-
|
|
11
|
-
&--selector {
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 0;
|
|
14
|
-
left: 0;
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
height: 100%;
|
|
19
|
-
background-color: var(--white);
|
|
20
|
-
border: 2px solid var(--G-10);
|
|
21
|
-
border-radius: 8px;
|
|
22
|
-
transition: all 0.2s;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.button {
|
|
28
|
-
height: 100%;
|
|
29
|
-
padding: 8px 5px;
|
|
30
|
-
color: var(--G-40);
|
|
31
|
-
transition: color 0.2s;
|
|
32
|
-
font-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
1
|
+
.segment {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: grid;
|
|
4
|
+
width: fit-content;
|
|
5
|
+
background-color: var(--G-10);
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
z-index: 0;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
font-size: 1em;
|
|
10
|
+
|
|
11
|
+
&--selector {
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
height: 100%;
|
|
19
|
+
background-color: var(--white);
|
|
20
|
+
border: 2px solid var(--G-10);
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
transition: all 0.2s;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.button {
|
|
28
|
+
height: 100%;
|
|
29
|
+
padding: 8px 5px;
|
|
30
|
+
color: var(--G-40);
|
|
31
|
+
transition: color 0.2s;
|
|
32
|
+
font-size: 1em;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
|
|
35
|
+
& > div {
|
|
36
|
+
position: relative;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
z-index: 10;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&--selected {
|
|
44
|
+
color: var(--G-80);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { useMemo, useState } from 'react';
|
|
2
|
-
import { cn } from '@jk-core/utils';
|
|
3
|
-
import styles from './SegmentButton.module.scss';
|
|
4
|
-
|
|
5
|
-
interface SegmentButtonProps {
|
|
6
|
-
/**
|
|
7
|
-
* 세그먼트 버튼의 너비를 지정합니다. 기본값은 'auto'입니다.
|
|
8
|
-
* 만약 stretch가 true로 설정되면, 너비는 'auto'로 설정됩니다.
|
|
9
|
-
*/
|
|
10
|
-
width?: string;
|
|
11
|
-
/**
|
|
12
|
-
* 세그먼트 버튼이 전체 너비를 차지하도록 설정합니다.
|
|
13
|
-
* true로 설정하면 버튼이 부모 요소의 너비를 채웁니다.
|
|
14
|
-
*/
|
|
15
|
-
stretch?: boolean;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 현재 세그먼트 버튼에서 선택된 인덱스입니다.
|
|
19
|
-
* 값을 설정시, 해당 인덱스의 버튼이 선택된 상태로 표시됩니다.
|
|
20
|
-
* 기본값은 0입니다.
|
|
21
|
-
*/
|
|
22
|
-
selected?: number;
|
|
23
|
-
/**
|
|
24
|
-
* 세그먼트 버튼의 옵션을 설정합니다.
|
|
25
|
-
* 각 옵션은 텍스트와 클릭 이벤트 핸들러를 포함합니다.
|
|
26
|
-
* 예시:
|
|
27
|
-
* ```ts
|
|
28
|
-
* option: [
|
|
29
|
-
* { text: '오늘', onClick: () => setDate(new Date()) },
|
|
30
|
-
* { text: '내일', onClick: () => setDate(new Date(Date.now() + 24 * 60 * 60 * 1000)) },
|
|
31
|
-
*/
|
|
32
|
-
option:Array<{ text: string; onClick: () => void }>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 세그먼트 버튼 컴포넌트는 여러 개의 버튼을 세그먼트 형태로 표시합니다.
|
|
37
|
-
* 각 버튼은 클릭 시 지정된 함수를 실행합니다.
|
|
38
|
-
*/
|
|
39
|
-
export default function SegmentButton({ width, stretch, option, selected }: SegmentButtonProps) {
|
|
40
|
-
const [index, setIndex] = useState(selected ?? 0);
|
|
41
|
-
|
|
42
|
-
const selectedIndex = useMemo(() => selected ?? index, [index, selected]);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={styles.segment}
|
|
47
|
-
style={{
|
|
48
|
-
width: stretch ? '100%' : undefined,
|
|
49
|
-
gridTemplateColumns: `repeat(${option.length},1fr)`,
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
className={styles['segment--selector']}
|
|
54
|
-
style={{
|
|
55
|
-
width: `${100 / option.length}%`,
|
|
56
|
-
left: `${selectedIndex * 100 / option.length}%`,
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
{option.map((item, optionIndex) => (
|
|
60
|
-
<button
|
|
61
|
-
className={cn({
|
|
62
|
-
[styles.button]: true,
|
|
63
|
-
[styles['button--selected']]: optionIndex === selectedIndex,
|
|
64
|
-
})}
|
|
65
|
-
key={item.text}
|
|
66
|
-
type="button"
|
|
67
|
-
style={{ width: stretch ? 'auto' : (width || 'auto') }}
|
|
68
|
-
onClick={() => {
|
|
69
|
-
item.onClick();
|
|
70
|
-
setIndex(optionIndex);
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
<div>
|
|
74
|
-
{item.text}
|
|
75
|
-
</div>
|
|
76
|
-
</button>
|
|
77
|
-
))}
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
|
+
import { cn } from '@jk-core/utils';
|
|
3
|
+
import styles from './SegmentButton.module.scss';
|
|
4
|
+
|
|
5
|
+
interface SegmentButtonProps {
|
|
6
|
+
/**
|
|
7
|
+
* 세그먼트 버튼의 너비를 지정합니다. 기본값은 'auto'입니다.
|
|
8
|
+
* 만약 stretch가 true로 설정되면, 너비는 'auto'로 설정됩니다.
|
|
9
|
+
*/
|
|
10
|
+
width?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 세그먼트 버튼이 전체 너비를 차지하도록 설정합니다.
|
|
13
|
+
* true로 설정하면 버튼이 부모 요소의 너비를 채웁니다.
|
|
14
|
+
*/
|
|
15
|
+
stretch?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 현재 세그먼트 버튼에서 선택된 인덱스입니다.
|
|
19
|
+
* 값을 설정시, 해당 인덱스의 버튼이 선택된 상태로 표시됩니다.
|
|
20
|
+
* 기본값은 0입니다.
|
|
21
|
+
*/
|
|
22
|
+
selected?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 세그먼트 버튼의 옵션을 설정합니다.
|
|
25
|
+
* 각 옵션은 텍스트와 클릭 이벤트 핸들러를 포함합니다.
|
|
26
|
+
* 예시:
|
|
27
|
+
* ```ts
|
|
28
|
+
* option: [
|
|
29
|
+
* { text: '오늘', onClick: () => setDate(new Date()) },
|
|
30
|
+
* { text: '내일', onClick: () => setDate(new Date(Date.now() + 24 * 60 * 60 * 1000)) },
|
|
31
|
+
*/
|
|
32
|
+
option:Array<{ text: string; onClick: () => void }>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 세그먼트 버튼 컴포넌트는 여러 개의 버튼을 세그먼트 형태로 표시합니다.
|
|
37
|
+
* 각 버튼은 클릭 시 지정된 함수를 실행합니다.
|
|
38
|
+
*/
|
|
39
|
+
export default function SegmentButton({ width, stretch, option, selected }: SegmentButtonProps) {
|
|
40
|
+
const [index, setIndex] = useState(selected ?? 0);
|
|
41
|
+
|
|
42
|
+
const selectedIndex = useMemo(() => selected ?? index, [index, selected]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
className={styles.segment}
|
|
47
|
+
style={{
|
|
48
|
+
width: stretch ? '100%' : undefined,
|
|
49
|
+
gridTemplateColumns: `repeat(${option.length},1fr)`,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<div
|
|
53
|
+
className={styles['segment--selector']}
|
|
54
|
+
style={{
|
|
55
|
+
width: `${100 / option.length}%`,
|
|
56
|
+
left: `${selectedIndex * 100 / option.length}%`,
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
{option.map((item, optionIndex) => (
|
|
60
|
+
<button
|
|
61
|
+
className={cn({
|
|
62
|
+
[styles.button]: true,
|
|
63
|
+
[styles['button--selected']]: optionIndex === selectedIndex,
|
|
64
|
+
})}
|
|
65
|
+
key={item.text}
|
|
66
|
+
type="button"
|
|
67
|
+
style={{ width: stretch ? 'auto' : (width || 'auto') }}
|
|
68
|
+
onClick={() => {
|
|
69
|
+
item.onClick();
|
|
70
|
+
setIndex(optionIndex);
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<div>
|
|
74
|
+
{item.text}
|
|
75
|
+
</div>
|
|
76
|
+
</button>
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
80
|
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
$color: #eeeeee;
|
|
2
|
-
$shadow: #e5e5e5;
|
|
3
|
-
|
|
4
|
-
@keyframes skeleton-blink {
|
|
5
|
-
0% {
|
|
6
|
-
left: -100%;
|
|
7
|
-
}
|
|
8
|
-
99.9% {
|
|
9
|
-
left: 100%;
|
|
10
|
-
}
|
|
11
|
-
100% {
|
|
12
|
-
left: -100%;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@keyframes skeleton-glow {
|
|
17
|
-
0% {
|
|
18
|
-
background-color: $color;
|
|
19
|
-
}
|
|
20
|
-
50% {
|
|
21
|
-
background-color: $shadow;
|
|
22
|
-
}
|
|
23
|
-
100% {
|
|
24
|
-
background-color: $color;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.skeleton-circle {
|
|
29
|
-
width: 100%;
|
|
30
|
-
height: 100%;
|
|
31
|
-
position: relative;
|
|
32
|
-
background-color: $color;
|
|
33
|
-
border-radius: 100%;
|
|
34
|
-
overflow: hidden;
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.skeleton-round {
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
position: relative;
|
|
42
|
-
background-color: $color;
|
|
43
|
-
border-radius: 10px;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
flex-shrink: 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.skeleton-rectangle {
|
|
49
|
-
width: 100%;
|
|
50
|
-
height: 100%;
|
|
51
|
-
position: relative;
|
|
52
|
-
background-color: $color;
|
|
53
|
-
flex-shrink: 0;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.skeleton--glow {
|
|
58
|
-
&::before {
|
|
59
|
-
content: "";
|
|
60
|
-
position: absolute;
|
|
61
|
-
top: 0;
|
|
62
|
-
width: 100%;
|
|
63
|
-
height: 100%;
|
|
64
|
-
left: 0;
|
|
65
|
-
animation: skeleton-glow 2s infinite;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.skeleton--blink {
|
|
70
|
-
&::before {
|
|
71
|
-
content: "";
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: 0;
|
|
74
|
-
left: -100%;
|
|
75
|
-
width: 100%;
|
|
76
|
-
height: 100%;
|
|
77
|
-
background: linear-gradient(to right, transparent, $shadow, transparent);
|
|
78
|
-
animation: skeleton-blink 3s infinite;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
1
|
+
$color: #eeeeee;
|
|
2
|
+
$shadow: #e5e5e5;
|
|
3
|
+
|
|
4
|
+
@keyframes skeleton-blink {
|
|
5
|
+
0% {
|
|
6
|
+
left: -100%;
|
|
7
|
+
}
|
|
8
|
+
99.9% {
|
|
9
|
+
left: 100%;
|
|
10
|
+
}
|
|
11
|
+
100% {
|
|
12
|
+
left: -100%;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@keyframes skeleton-glow {
|
|
17
|
+
0% {
|
|
18
|
+
background-color: $color;
|
|
19
|
+
}
|
|
20
|
+
50% {
|
|
21
|
+
background-color: $shadow;
|
|
22
|
+
}
|
|
23
|
+
100% {
|
|
24
|
+
background-color: $color;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.skeleton-circle {
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
position: relative;
|
|
32
|
+
background-color: $color;
|
|
33
|
+
border-radius: 100%;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.skeleton-round {
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
position: relative;
|
|
42
|
+
background-color: $color;
|
|
43
|
+
border-radius: 10px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.skeleton-rectangle {
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
position: relative;
|
|
52
|
+
background-color: $color;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.skeleton--glow {
|
|
58
|
+
&::before {
|
|
59
|
+
content: "";
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
left: 0;
|
|
65
|
+
animation: skeleton-glow 2s infinite;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.skeleton--blink {
|
|
70
|
+
&::before {
|
|
71
|
+
content: "";
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: -100%;
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
background: linear-gradient(to right, transparent, $shadow, transparent);
|
|
78
|
+
animation: skeleton-blink 3s infinite;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import styles from './Skeleton.module.scss';
|
|
2
|
-
|
|
3
|
-
interface SkeletonProps {
|
|
4
|
-
/**
|
|
5
|
-
* 스켈레톤의 모양을 지정합니다. 'circle', 'rectangle', 'round' 중 하나를 선택할 수 있습니다.
|
|
6
|
-
* 기본값은 'rectangle'입니다.
|
|
7
|
-
*/
|
|
8
|
-
shape?: 'circle' | 'rectangle' | 'round';
|
|
9
|
-
/**
|
|
10
|
-
* 스켈레톤의 너비를 지정합니다. 기본값은 '100%'입니다.
|
|
11
|
-
* 'auto'로 설정하면 콘텐츠에 맞게 자동으로 조정됩니다.
|
|
12
|
-
*/
|
|
13
|
-
width?: string | number;
|
|
14
|
-
/**
|
|
15
|
-
* 스켈레톤의 높이를 지정합니다. 기본값은 '20px'입니다.
|
|
16
|
-
* 'auto'로 설정하면 콘텐츠에 맞게 자동으로 조정됩니다.
|
|
17
|
-
*/
|
|
18
|
-
height?: string | number;
|
|
19
|
-
/**
|
|
20
|
-
* 스켈레톤 애니메이션 효과를 지정합니다. 'glow' 또는 'blink' 중 하나를 선택할 수 있습니다.
|
|
21
|
-
* 기본값은 'glow'입니다.
|
|
22
|
-
*/
|
|
23
|
-
animation?: 'glow' | 'blink';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 스켈레톤 컴포넌트는 로딩 상태를 나타내기 위해 사용됩니다.
|
|
28
|
-
* 다양한 모양과 크기를 지원하며, 애니메이션 효과를 적용할 수 있습니다.
|
|
29
|
-
*/
|
|
30
|
-
export default function Skeleton({ shape, width, height, animation = 'glow' }: SkeletonProps) {
|
|
31
|
-
const animationClass = animation === 'glow' ? styles['skeleton--glow'] : styles['skeleton--blink'];
|
|
32
|
-
|
|
33
|
-
if (shape === 'circle') {
|
|
34
|
-
return (
|
|
35
|
-
<div className={`${styles['skeleton-circle']} ${animationClass}`} style={{ width, height }} />
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (shape === 'round') {
|
|
40
|
-
return (
|
|
41
|
-
<div className={`${styles['skeleton-round']} ${animationClass}`} style={{ width, height }} />
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className={`${styles['skeleton-rectangle']} ${animationClass}`} style={{ width, height }} />
|
|
47
|
-
);
|
|
1
|
+
import styles from './Skeleton.module.scss';
|
|
2
|
+
|
|
3
|
+
interface SkeletonProps {
|
|
4
|
+
/**
|
|
5
|
+
* 스켈레톤의 모양을 지정합니다. 'circle', 'rectangle', 'round' 중 하나를 선택할 수 있습니다.
|
|
6
|
+
* 기본값은 'rectangle'입니다.
|
|
7
|
+
*/
|
|
8
|
+
shape?: 'circle' | 'rectangle' | 'round';
|
|
9
|
+
/**
|
|
10
|
+
* 스켈레톤의 너비를 지정합니다. 기본값은 '100%'입니다.
|
|
11
|
+
* 'auto'로 설정하면 콘텐츠에 맞게 자동으로 조정됩니다.
|
|
12
|
+
*/
|
|
13
|
+
width?: string | number;
|
|
14
|
+
/**
|
|
15
|
+
* 스켈레톤의 높이를 지정합니다. 기본값은 '20px'입니다.
|
|
16
|
+
* 'auto'로 설정하면 콘텐츠에 맞게 자동으로 조정됩니다.
|
|
17
|
+
*/
|
|
18
|
+
height?: string | number;
|
|
19
|
+
/**
|
|
20
|
+
* 스켈레톤 애니메이션 효과를 지정합니다. 'glow' 또는 'blink' 중 하나를 선택할 수 있습니다.
|
|
21
|
+
* 기본값은 'glow'입니다.
|
|
22
|
+
*/
|
|
23
|
+
animation?: 'glow' | 'blink';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 스켈레톤 컴포넌트는 로딩 상태를 나타내기 위해 사용됩니다.
|
|
28
|
+
* 다양한 모양과 크기를 지원하며, 애니메이션 효과를 적용할 수 있습니다.
|
|
29
|
+
*/
|
|
30
|
+
export default function Skeleton({ shape, width, height, animation = 'glow' }: SkeletonProps) {
|
|
31
|
+
const animationClass = animation === 'glow' ? styles['skeleton--glow'] : styles['skeleton--blink'];
|
|
32
|
+
|
|
33
|
+
if (shape === 'circle') {
|
|
34
|
+
return (
|
|
35
|
+
<div className={`${styles['skeleton-circle']} ${animationClass}`} style={{ width, height }} />
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (shape === 'round') {
|
|
40
|
+
return (
|
|
41
|
+
<div className={`${styles['skeleton-round']} ${animationClass}`} style={{ width, height }} />
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={`${styles['skeleton-rectangle']} ${animationClass}`} style={{ width, height }} />
|
|
47
|
+
);
|
|
48
48
|
}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
$main: #246beb;
|
|
2
|
-
$main-shadow: #113475;
|
|
3
|
-
$background: #eeeeee;
|
|
4
|
-
$shadow: #bcbcbc;
|
|
5
|
-
|
|
6
|
-
.button {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
height: 20px;
|
|
10
|
-
border: none;
|
|
11
|
-
background-color: transparent;
|
|
12
|
-
margin: 0 5px;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.switch {
|
|
17
|
-
position: relative;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
width: 50px;
|
|
21
|
-
height: 25px;
|
|
22
|
-
border-radius: 100px;
|
|
23
|
-
background-color: $background;
|
|
24
|
-
box-shadow: inset 0 0 3px 1px $shadow;
|
|
25
|
-
transition: background-color 0.2s;
|
|
26
|
-
|
|
27
|
-
&__off {
|
|
28
|
-
background-color: $main;
|
|
29
|
-
border-color: $main;
|
|
30
|
-
box-shadow: inset 0 0 3px 1px $main-shadow;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&__button {
|
|
34
|
-
position: absolute;
|
|
35
|
-
width: 25px;
|
|
36
|
-
height: 25px;
|
|
37
|
-
border-radius: 100px;
|
|
38
|
-
transition: 0.2s;
|
|
39
|
-
padding: 2px;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
|
|
42
|
-
&--circle {
|
|
43
|
-
width: 100%;
|
|
44
|
-
height: 100%;
|
|
45
|
-
background-color: #ffffff;
|
|
46
|
-
border-radius: 100%;
|
|
47
|
-
box-shadow: 0 0 5px 1px $shadow;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&--circle-on {
|
|
51
|
-
box-shadow: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&--off {
|
|
55
|
-
left: 0px;
|
|
56
|
-
transition: 0.2s;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&--on {
|
|
60
|
-
left: 25px;
|
|
61
|
-
transition: 0.2s;
|
|
62
|
-
border-color: $main;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
$main: #246beb;
|
|
2
|
+
$main-shadow: #113475;
|
|
3
|
+
$background: #eeeeee;
|
|
4
|
+
$shadow: #bcbcbc;
|
|
5
|
+
|
|
6
|
+
.button {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
height: 20px;
|
|
10
|
+
border: none;
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
margin: 0 5px;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.switch {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
width: 50px;
|
|
21
|
+
height: 25px;
|
|
22
|
+
border-radius: 100px;
|
|
23
|
+
background-color: $background;
|
|
24
|
+
box-shadow: inset 0 0 3px 1px $shadow;
|
|
25
|
+
transition: background-color 0.2s;
|
|
26
|
+
|
|
27
|
+
&__off {
|
|
28
|
+
background-color: $main;
|
|
29
|
+
border-color: $main;
|
|
30
|
+
box-shadow: inset 0 0 3px 1px $main-shadow;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__button {
|
|
34
|
+
position: absolute;
|
|
35
|
+
width: 25px;
|
|
36
|
+
height: 25px;
|
|
37
|
+
border-radius: 100px;
|
|
38
|
+
transition: 0.2s;
|
|
39
|
+
padding: 2px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
|
|
42
|
+
&--circle {
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
background-color: #ffffff;
|
|
46
|
+
border-radius: 100%;
|
|
47
|
+
box-shadow: 0 0 5px 1px $shadow;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--circle-on {
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&--off {
|
|
55
|
+
left: 0px;
|
|
56
|
+
transition: 0.2s;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&--on {
|
|
60
|
+
left: 25px;
|
|
61
|
+
transition: 0.2s;
|
|
62
|
+
border-color: $main;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|