@edu-tosel/design 1.0.324 → 1.0.325

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.
@@ -1,19 +1,33 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { toSelectOption } from "../../../interface";
2
3
  import { cn } from "../../../util";
3
4
  import { useResponsive } from "../../../hook";
5
+ import { useState } from "react";
4
6
  export default function ShortcutBanner({ shortcuts, }) {
5
7
  const isXS = useResponsive("xs");
8
+ const [isExpanded, setIsExpanded] = useState(false);
6
9
  const container = {
7
10
  displays: "flex flex-col justify-start justify-start xs:justify-center xs:items-center",
8
11
  spacings: "pt-10 pb-15",
9
12
  };
13
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: "w-full flex justify-center items-center mb-5", children: _jsx(ModeToggle, { state: [isExpanded, setIsExpanded], selectOptions: [
14
+ [true, "스크롤"],
15
+ [false, "그리드"],
16
+ ] }) }), !isExpanded ? (_jsx(ScrollMode, { shortcuts: shortcuts })) : (_jsx(GridMode, { shortcuts: shortcuts }))] }));
17
+ }
18
+ function ScrollMode({ shortcuts, }) {
10
19
  const scrollWrapper = {
11
20
  displays: "flex justify-start items-center overflow-x-scroll scrollbar-hidden",
12
21
  sizes: "w-full h-fit",
13
- spacings: "px-5 pb-5",
22
+ spacings: "px-5 pb-10",
14
23
  graphics: "antialiased",
15
24
  boundaries: "border-b-1 border-gray-200",
16
25
  };
26
+ const buttonWrapper = {
27
+ displays: "flex justify-center items-center",
28
+ sizes: "min-w-fit h-fit",
29
+ spacings: "gap-x-4 xs:gap-x-10 mx-auto py-2 px-0 xs:px-5 md:pl-18",
30
+ };
17
31
  const headerButton = {
18
32
  displays: "flex flex-col justify-center items-center",
19
33
  sizes: "h-fit w-fit shrink-0",
@@ -21,11 +35,41 @@ export default function ShortcutBanner({ shortcuts, }) {
21
35
  backgrounds: "bg-gray-50",
22
36
  textStyles: "font-bold text-gray-600",
23
37
  };
24
- const buttonWrapper = {
38
+ const buttonSet = {
39
+ displays: "group flex flex-col justify-center items-center",
40
+ sizes: "w-16",
41
+ spacings: "gap-2",
42
+ };
43
+ const tagBox = {
25
44
  displays: "flex justify-center items-center",
26
- sizes: "min-w-fit h-fit",
27
- spacings: "gap-x-4 xs:gap-x-10 mx-auto py-2",
28
- graphics: "antialiased",
45
+ sizes: "w-full h-6.25 ",
46
+ fonts: "text-xs md:text-sm font-pretendard-var font-medium text-gray-dark group-hover:text-green-dark",
47
+ animation: "duration-100",
48
+ };
49
+ const iconContainer = {
50
+ sizes: "size-14 xs:size-16 rounded-lg overflow-hidden",
51
+ shadows: "shadow-none",
52
+ animation: "duration-100",
53
+ hoveraction: "group-hover:shadow-icon-hover group-hover:scale-103",
54
+ };
55
+ return (_jsx("div", { className: cn(scrollWrapper), children: _jsxs("div", { className: cn(buttonWrapper), children: [_jsxs("div", { className: cn(headerButton), children: [_jsx("div", { children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "size-6", children: _jsx("path", { "fill-rule": "evenodd", d: "M14.615 1.595a.75.75 0 0 1 .359.852L12.982 9.75h7.268a.75.75 0 0 1 .548 1.262l-10.5 11.25a.75.75 0 0 1-1.272-.71l1.992-7.302H3.75a.75.75 0 0 1-.548-1.262l10.5-11.25a.75.75 0 0 1 .913-.143Z", "clip-rule": "evenodd" }) }) }), _jsx("div", { className: "font-bold text-sm xs:text-base", children: "\uBE60\uB978 \uBA54\uB274" })] }), shortcuts.map((shortcut) => (_jsxs("button", { onClick: shortcut.onClick, className: cn(buttonSet), children: [_jsx("div", { className: cn(iconContainer, shortcut.background ?? "bg-gray-100"), children: _jsx("img", { src: shortcut.icon, alt: shortcut.title }) }), _jsx("div", { className: cn(tagBox), children: shortcut.title })] }, shortcut.title)))] }) }));
56
+ }
57
+ function GridMode({ shortcuts, }) {
58
+ const container = {
59
+ displays: "flex flex-col justify-center items-center",
60
+ spacings: "gap-y-10 mt-5",
61
+ sizes: "w-full h-fit",
62
+ };
63
+ const gridWrapper = {
64
+ displays: "grid grid-cols-3 xxxs:grid-cols-4 justify-items-center",
65
+ sizes: "w-full max-w-140",
66
+ spacings: "gap-y-5",
67
+ };
68
+ const titleBox = {
69
+ displays: "flex flex-row gap-2",
70
+ spacings: "px-5 py-2 rounded-lg",
71
+ textStyles: "font-bold text-base text-gray-700",
72
+ backgrounds: "bg-gray-100",
29
73
  };
30
74
  const buttonSet = {
31
75
  displays: "group flex flex-col justify-center items-center",
@@ -44,5 +88,46 @@ export default function ShortcutBanner({ shortcuts, }) {
44
88
  animation: "duration-100",
45
89
  hoveraction: "group-hover:shadow-icon-hover group-hover:scale-103",
46
90
  };
47
- return (_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(scrollWrapper), children: _jsxs("div", { className: cn(buttonWrapper), children: [_jsxs("div", { className: cn(headerButton), children: [_jsx("div", { children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "size-6", children: _jsx("path", { d: "M5.055 7.06C3.805 6.347 2.25 7.25 2.25 8.69v8.122c0 1.44 1.555 2.343 2.805 1.628L12 14.471v2.34c0 1.44 1.555 2.343 2.805 1.628l7.108-4.061c1.26-.72 1.26-2.536 0-3.256l-7.108-4.061C13.555 6.346 12 7.249 12 8.689v2.34L5.055 7.061Z" }) }) }), _jsx("div", { className: "font-bold text-sm xs:text-base", children: "\uBE60\uB978 \uBA54\uB274" })] }), shortcuts.map((shortcut) => (_jsxs("button", { onClick: shortcut.onClick, className: cn(buttonSet), children: [_jsx("div", { className: cn(iconContainer, shortcut.background ?? "bg-gray-100"), children: _jsx("img", { src: shortcut.icon, alt: shortcut.title }) }), _jsx("div", { className: cn(tagBox), children: shortcut.title })] }, shortcut.title)))] }) }) }));
91
+ return (_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(gridWrapper), children: shortcuts.map((shortcut) => (_jsxs("button", { onClick: shortcut.onClick, className: cn(buttonSet), children: [_jsx("div", { className: cn(iconContainer, shortcut.background ?? "bg-gray-100"), children: _jsx("img", { src: shortcut.icon, alt: shortcut.title }) }), _jsx("div", { className: cn(tagBox), children: shortcut.title })] }, shortcut.title))) }) }));
92
+ }
93
+ function ModeToggle({ state, selectOptions: selectOptionsInput, option, }) {
94
+ const selectOptions = selectOptionsInput?.map(toSelectOption);
95
+ const [value, setValue] = state;
96
+ const isOff = value === selectOptions[0].value;
97
+ const toggle = () => {
98
+ if (state[0] === selectOptions[0].value)
99
+ return setValue(selectOptions[1].value);
100
+ return setValue(selectOptions[0].value);
101
+ };
102
+ const container = {
103
+ displays: "relative flex flex-row",
104
+ spacings: "p-1",
105
+ sizes: "rounded-full w-fit",
106
+ backgrounds: "bg-gray-100",
107
+ textStyles: "text-sm font-medium",
108
+ };
109
+ const activeButton = {
110
+ displays: "flex flex-row gap-1 justify-center items-center z-10",
111
+ sizes: "w-24",
112
+ spacings: "rounded-full py-1",
113
+ textStyles: "text-green-dark font-bold leading-none",
114
+ scale: "scale-110",
115
+ duration: "duration-300",
116
+ };
117
+ const inactiveButton = {
118
+ displays: "flex flex-row gap-1 justify-center items-center z-10",
119
+ sizes: "w-24",
120
+ spacings: "rounded-full py-1",
121
+ textStyles: "text-gray-500 font-medium leading-none",
122
+ duration: "duration-300",
123
+ };
124
+ const clearKnob = {
125
+ displays: "absolute",
126
+ locations: !isOff ? "left-1" : "left-[calc(100%-6.25rem)]",
127
+ sizes: "h-[calc(100%-8px)] w-24 z-1",
128
+ backgrounds: "bg-white/30 shadow-main",
129
+ boundaries: "rounded-full",
130
+ animations: "duration-200",
131
+ };
132
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(clearKnob) }), _jsxs("button", { onClick: toggle, className: cn(selectOptions[1].value === value ? activeButton : inactiveButton), children: [selectOptions[0].title, _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "size-5", children: _jsx("path", { "fill-rule": "evenodd", d: "M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm14.25 6a.75.75 0 0 1-.22.53l-2.25 2.25a.75.75 0 1 1-1.06-1.06L15.44 12l-1.72-1.72a.75.75 0 1 1 1.06-1.06l2.25 2.25c.141.14.22.331.22.53Zm-10.28-.53a.75.75 0 0 0 0 1.06l2.25 2.25a.75.75 0 1 0 1.06-1.06L8.56 12l1.72-1.72a.75.75 0 1 0-1.06-1.06l-2.25 2.25Z", "clip-rule": "evenodd" }) })] }), _jsxs("button", { onClick: toggle, className: cn(selectOptions[0].value === value ? activeButton : inactiveButton), children: [selectOptions[1].title, _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "size-5", children: _jsx("path", { "fill-rule": "evenodd", d: "M3 6a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3V6ZM3 15.75a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2.25Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3v-2.25Z", "clip-rule": "evenodd" }) })] })] }));
48
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.324",
3
+ "version": "1.0.325",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.324
1
+ 1.0.325