atomsystem 0.1.25 → 0.1.27
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 +13 -5
- package/app/templates/Badge/Badge.tsx +2 -4
- package/app/templates/Button/Button.tsx +2 -24
- package/app/templates/Card/Card.tsx +4 -5
- package/app/templates/CodeBlock/CodeBlock.tsx +18 -2
- package/app/templates/Collapse/Collapse.tsx +10 -10
- package/app/templates/{Input/Input.tsx → Form/Form.tsx} +69 -88
- package/app/templates/Modal/Modal.tsx +7 -7
- package/app/templates/Navigation/Navigation.tsx +306 -0
- package/app/templates/Pagination/Pagination.tsx +6 -6
- package/app/templates/Tab/Tab.tsx +10 -10
- package/app/templates/Table/Table.tsx +9 -18
- package/app/templates/Theme/Theme.tsx +87 -80
- package/app/templates/Toast/Toast.tsx +4 -4
- package/build/build-tokens.js +204 -53
- package/build/css/_variables.css +315 -0
- package/build/typescript/theme.ts +14 -0
- package/cli/add.js +35 -3
- package/cli/init.js +82 -14
- package/css/badge.css +28 -0
- package/css/button.css +75 -0
- package/css/card.css +17 -0
- package/css/collapse.css +33 -0
- package/css/form.css +115 -0
- package/css/modal.css +98 -0
- package/css/navigation.css +69 -0
- package/css/pagination.css +66 -0
- package/css/tab.css +56 -0
- package/css/table.css +58 -0
- package/css/text.css +25 -0
- package/css/toast.css +69 -0
- package/package.json +10 -6
- package/tokens/tokens.json +949 -0
- package/app/templates/GlobalNav/GlobalNav.tsx +0 -199
- package/token.json +0 -492
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
import { usePathname } from "next/navigation";
|
|
6
|
-
import clsx from "clsx";
|
|
7
|
-
|
|
8
|
-
const GlobalNav = ({
|
|
9
|
-
type = "sidebar",
|
|
10
|
-
navMenu,
|
|
11
|
-
}: {
|
|
12
|
-
type?: "sidebar" | "topmenu" | "mobile";
|
|
13
|
-
navMenu: {
|
|
14
|
-
name: string;
|
|
15
|
-
path?: string;
|
|
16
|
-
subItems?: { name: string; path: string }[];
|
|
17
|
-
label?: boolean;
|
|
18
|
-
}[];
|
|
19
|
-
}) => {
|
|
20
|
-
const [windowSize, setWindowSize] = useState<number>(); // 초기값 설정
|
|
21
|
-
const [toggleMenu, setToggleMenu] = useState<boolean>(true);
|
|
22
|
-
const pathname = usePathname();
|
|
23
|
-
const [openSubMenu, setOpenSubMenu] = useState<Record<string, boolean>>({});
|
|
24
|
-
|
|
25
|
-
// 윈도우 사이즈 추적
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
const handleResize = () => {
|
|
28
|
-
setWindowSize(window.innerWidth); // 윈도우 사이즈 업데이트
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
window.addEventListener("resize", handleResize); // 리사이즈 이벤트 리스너 추가
|
|
32
|
-
|
|
33
|
-
return () => window.removeEventListener("resize", handleResize); // 컴포넌트 언마운트 시 리스너 제거
|
|
34
|
-
}, [windowSize]);
|
|
35
|
-
|
|
36
|
-
// 초기 토글 값 설정
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (window.innerWidth > 768) {
|
|
39
|
-
} else {
|
|
40
|
-
setToggleMenu(false);
|
|
41
|
-
}
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
|
-
const toggleSubMenu = (menuName: string) => {
|
|
45
|
-
setOpenSubMenu((prev) => ({
|
|
46
|
-
...prev,
|
|
47
|
-
[menuName]: !prev[menuName],
|
|
48
|
-
}));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<>
|
|
53
|
-
<nav
|
|
54
|
-
className={clsx(
|
|
55
|
-
`fixed top-0 md:relative w-full bg-[var(--background-card)] text-text-standard z-20 left-0 ${toggleMenu ? "block" : "hidden"}`,
|
|
56
|
-
{ "h-full max-w-80 overflow-auto": type == "sidebar" },
|
|
57
|
-
{ "h-auto flex flex-row items-center": type == "topmenu" }
|
|
58
|
-
)}
|
|
59
|
-
>
|
|
60
|
-
{/* brand */}
|
|
61
|
-
<div className="brand">
|
|
62
|
-
<div className="flex items-center justify-between">
|
|
63
|
-
<Link href={"/"}>
|
|
64
|
-
<Image
|
|
65
|
-
src={"/images/global/logo.png"}
|
|
66
|
-
alt="Logo"
|
|
67
|
-
width={180}
|
|
68
|
-
height={45}
|
|
69
|
-
draggable="false"
|
|
70
|
-
></Image>
|
|
71
|
-
</Link>
|
|
72
|
-
{type == "sidebar" ? (
|
|
73
|
-
<button className="p-4 cursor-pointer">
|
|
74
|
-
<span
|
|
75
|
-
className="material-symbols-outlined text-[var(--text-standard)]"
|
|
76
|
-
onClick={() => setToggleMenu(false)}
|
|
77
|
-
style={{ fontSize: "16px" }}
|
|
78
|
-
>
|
|
79
|
-
close
|
|
80
|
-
</span>
|
|
81
|
-
</button>
|
|
82
|
-
) : null}
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
{/* List */}
|
|
87
|
-
<ul
|
|
88
|
-
className={clsx("", {
|
|
89
|
-
"flex flex-row": type == "topmenu",
|
|
90
|
-
})}
|
|
91
|
-
>
|
|
92
|
-
{navMenu.map((menu, idx) => {
|
|
93
|
-
switch (true) {
|
|
94
|
-
case menu.label === true && type == "sidebar":
|
|
95
|
-
return (
|
|
96
|
-
<p
|
|
97
|
-
key={menu.name + idx}
|
|
98
|
-
className="px-4 text-sm text-sub mt-2 mb-0"
|
|
99
|
-
>
|
|
100
|
-
{menu.name}
|
|
101
|
-
</p>
|
|
102
|
-
);
|
|
103
|
-
default:
|
|
104
|
-
if (!menu.path) return null;
|
|
105
|
-
return (
|
|
106
|
-
<li className="relative group" key={menu.name}>
|
|
107
|
-
<div
|
|
108
|
-
className={clsx("flex justify-between items-center pr-4")}
|
|
109
|
-
>
|
|
110
|
-
<Link
|
|
111
|
-
href={menu.path}
|
|
112
|
-
className={clsx(
|
|
113
|
-
"px-4 py-2 block text-[var(--text-standard)]",
|
|
114
|
-
{
|
|
115
|
-
"text-primary":
|
|
116
|
-
menu.path == pathname ||
|
|
117
|
-
menu.subItems?.some(
|
|
118
|
-
(sub) => sub.path === pathname
|
|
119
|
-
),
|
|
120
|
-
}
|
|
121
|
-
)}
|
|
122
|
-
>
|
|
123
|
-
{menu.name}
|
|
124
|
-
</Link>
|
|
125
|
-
{menu.subItems && type == "sidebar" ? (
|
|
126
|
-
<button
|
|
127
|
-
className="cursor-pointer"
|
|
128
|
-
onClick={() => toggleSubMenu(menu.name)}
|
|
129
|
-
>
|
|
130
|
-
<span
|
|
131
|
-
className={clsx(
|
|
132
|
-
"material-symbols-outlined text-[var(--text-sub)] transition-transform",
|
|
133
|
-
{
|
|
134
|
-
"rotate-90": openSubMenu[menu.name],
|
|
135
|
-
}
|
|
136
|
-
)}
|
|
137
|
-
style={{ fontSize: "16px" }}
|
|
138
|
-
>
|
|
139
|
-
keyboard_arrow_right
|
|
140
|
-
</span>
|
|
141
|
-
</button>
|
|
142
|
-
) : null}
|
|
143
|
-
</div>
|
|
144
|
-
{menu.subItems ? (
|
|
145
|
-
<ul
|
|
146
|
-
className={clsx(
|
|
147
|
-
"block",
|
|
148
|
-
{
|
|
149
|
-
"hidden absolute top-[42px] group-hover:block hover:block bg-[var(--background-card)]":
|
|
150
|
-
type == "topmenu",
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
hidden:
|
|
154
|
-
!openSubMenu[menu.name] && type == "sidebar",
|
|
155
|
-
}
|
|
156
|
-
)}
|
|
157
|
-
>
|
|
158
|
-
{menu.subItems.map((submenu) => {
|
|
159
|
-
return (
|
|
160
|
-
<li key={submenu.name}>
|
|
161
|
-
<Link
|
|
162
|
-
className={clsx(
|
|
163
|
-
"px-4 py-2 block text-[var(--text-standard)]",
|
|
164
|
-
{
|
|
165
|
-
"text-primary": submenu.path == pathname,
|
|
166
|
-
},
|
|
167
|
-
{ "pl-12 ": type == "sidebar" }
|
|
168
|
-
)}
|
|
169
|
-
href={submenu.path}
|
|
170
|
-
>
|
|
171
|
-
{submenu.name}
|
|
172
|
-
</Link>
|
|
173
|
-
</li>
|
|
174
|
-
);
|
|
175
|
-
})}
|
|
176
|
-
</ul>
|
|
177
|
-
) : null}
|
|
178
|
-
</li>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
})}
|
|
182
|
-
</ul>
|
|
183
|
-
</nav>
|
|
184
|
-
<button
|
|
185
|
-
className={`fixed shadow-md rounded-full bg-[var(--background-card)] w-12 h-12 top-6 left-6 z-10 cursor-pointer ${toggleMenu ? "hidden" : "block"} `}
|
|
186
|
-
onClick={() => setToggleMenu(true)}
|
|
187
|
-
>
|
|
188
|
-
<span
|
|
189
|
-
className="material-symbols-outlined text-[var(--text-standard)]"
|
|
190
|
-
style={{ fontSize: "16px" }}
|
|
191
|
-
>
|
|
192
|
-
menu
|
|
193
|
-
</span>
|
|
194
|
-
</button>
|
|
195
|
-
</>
|
|
196
|
-
);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export default GlobalNav;
|