Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop to main #50

Open
wants to merge 109 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
fcbf0dd
fix: add y scroll to page wrapper
b41-41 Jul 19, 2024
276f697
fix: fix float button width
b41-41 Jul 19, 2024
d8ef8ff
fix: change sign up button color
b41-41 Jul 19, 2024
171e94a
feat: ํ…์ŠคํŠธํ•„๋“œ ์ˆ˜์ •์™„
lgrin-byte Jul 19, 2024
8517d31
Merge pull request #48 from Next-Room/style/QA
lgrin-byte Jul 19, 2024
0d5eb89
chore: ์ฃผ์„์ œ๊ฑฐ
lgrin-byte Jul 19, 2024
c3bc0d7
Merge branch 'style/QA' into develop
lgrin-byte Jul 19, 2024
d53f5ee
Merge pull request #49 from Next-Room/fix/design_qa_240719
b41-41 Jul 22, 2024
6d1c0bb
feat: ์ž„์‹œ
lgrin-byte Jul 26, 2024
452e15e
feat: 1280px fix width size
lgrin-byte Jul 28, 2024
8e78b2c
feat: modify login textfield
lgrin-byte Jul 28, 2024
b09ab18
Merge branch 'develop' into style/QA
lgrin-byte Jul 28, 2024
11e64bb
Merge pull request #51 from Next-Room/style/QA
lgrin-byte Jul 28, 2024
0f9240f
feat: ํฐํŠธ, ์ปฌ๋Ÿฌ ๋””์ž์ธ ์‹œ์Šคํ…œ ์ถ”๊ฐ€
lgrin-byte Sep 1, 2024
7694d52
Merge branch 'develop' into feat/storybook
lgrin-byte Sep 1, 2024
17db3b2
Merge pull request #52 from Next-Room/feat/storybook
lgrin-byte Sep 1, 2024
2dbad53
feat: theme ์ถ”๊ฐ€
lgrin-byte Sep 1, 2024
2367d90
Merge pull request #53 from Next-Room/feat/storybook
lgrin-byte Sep 1, 2024
3c622d6
feat: new admin ์ปดํฌ๋„ŒํŠธ ์ƒ์„ฑ
lgrin-byte Sep 14, 2024
b11af76
feat: bulid ์—๋Ÿฌ ์ˆ˜์ •
lgrin-byte Sep 14, 2024
23742bd
feat: props ํƒ€์ž… ์„ค์ •
lgrin-byte Sep 14, 2024
45c382f
Merge pull request #54 from Next-Room/feat/new-admin
lgrin-byte Sep 17, 2024
b6661e2
style: ์ƒ‰์ƒ ๋ณ€๊ฒฝ
lgrin-byte Sep 18, 2024
b816cde
Merge pull request #56 from Next-Room/feat/new-admin
lgrin-byte Sep 18, 2024
2757eaf
style: qa ๋ฐ˜์˜
lgrin-byte Sep 18, 2024
45be771
style: qa ๋ฐ˜์˜
lgrin-byte Sep 18, 2024
3286ca7
Merge pull request #57 from Next-Room/feat/new-admin
lgrin-byte Sep 18, 2024
fd73571
feat: sidebar ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ
lgrin-byte Sep 18, 2024
161afff
feat: sidebar ์ƒ์ˆ˜ ๋ถ„๋ฆฌ
lgrin-byte Sep 18, 2024
c34b7b6
style: ๋””์ž์ธ 1์ฐจ qa๋ฐ˜์˜
lgrin-byte Sep 18, 2024
cea6bb2
feat: build ์—๋Ÿฌ ์ˆ˜์ •
lgrin-byte Sep 18, 2024
24c23e7
feat: ContentArea ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ
lgrin-byte Sep 18, 2024
da298d7
Merge pull request #58 from Next-Room/feat/new-admin
lgrin-byte Sep 18, 2024
67ffd5a
fix: import์ œ๊ฑฐ
lgrin-byte Sep 18, 2024
4e29829
fix: import์ œ๊ฑฐ
lgrin-byte Sep 18, 2024
0ab9481
style: ๋””์ž์ธ ํ•ด์ƒ๋„ qa
lgrin-byte Sep 18, 2024
0f8c0e8
Merge pull request #59 from Next-Room/feat/new-admin
lgrin-byte Sep 18, 2024
1495891
Merge branch 'develop' of https://github.com/Next-Room/nextRoomFE intโ€ฆ
lgrin-byte Sep 18, 2024
2662407
style: content ์ค‘์•™์ •๋ ฌ
lgrin-byte Sep 18, 2024
adaaf91
Merge branch 'feat/new-admin' into develop
lgrin-byte Sep 18, 2024
f101e12
Merge branch 'develop' of https://github.com/Next-Room/nextRoomFE intโ€ฆ
lgrin-byte Sep 18, 2024
b27e0c9
chore: pnpm ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ๋ฐ warning ์ˆ˜์ •
anyl92 Sep 13, 2024
54655bc
test: jest ์„ค์น˜ ๋ฐ cypress์™€ ๋ถ„๋ฆฌ ์„ค์ •
anyl92 Sep 16, 2024
b23f92d
Merge pull request #60 from Next-Room/feat/signup-test
anyl92 Sep 18, 2024
66b3553
fix: pnpm run build ์—๋Ÿฌ
anyl92 Sep 18, 2024
5bddcca
Merge pull request #61 from Next-Room/fix/types
anyl92 Sep 18, 2024
a83d15b
fix: build types ์—๋Ÿฌ
lgrin-byte Sep 18, 2024
26c7c6a
Revert "fix: pnpm run build ์—๋Ÿฌ"
lgrin-byte Sep 18, 2024
47d262c
Merge pull request #62 from Next-Room/revert-61-fix/types
lgrin-byte Sep 18, 2024
de879e3
Revert "refactor: npm -> pnpm ๋ณ€๊ฒฝ "
lgrin-byte Sep 18, 2024
c1fdca2
Merge pull request #63 from Next-Room/revert-60-feat/signup-test
lgrin-byte Sep 18, 2024
9c40757
Merge branch 'develop' of https://github.com/Next-Room/nextRoomFE intโ€ฆ
lgrin-byte Sep 18, 2024
1d9f4b3
feat: CreateTheme UI && TextField DesignSystem ์ž‘์—…
anyl92 Sep 21, 2024
dd15e73
chore: sass ์„ค์น˜, css/mapํŒŒ์ผ ์‚ญ์ œ
anyl92 Sep 21, 2024
6de8814
style: ์ปดํฌ๋„ŒํŠธ๋ณ„ ์Šคํƒ€์ผ ๋ถ„๋ฆฌ
anyl92 Sep 21, 2024
093138f
refactor: ๋ถˆํ•„์š”ํ•œ ์ปดํฌ๋„ŒํŠธ ์‚ญ์ œ ๋ฐ ํ†ตํ•ฉ
anyl92 Sep 21, 2024
8c5dc0f
feat: textField inputValue์— ๋”ฐ๋ฅธ button ํ™œ์„ฑํ™” UI
anyl92 Sep 21, 2024
bcf71ac
feat: ํ…Œ๋งˆ ์ƒ์„ฑ
anyl92 Sep 21, 2024
5b9b2a5
fix: tab focus ๊ฐ€๋Šฅํ•˜๊ฒŒ, ํžŒํŠธ ์ˆ˜ ์—†์–ด๋„ ๋ฒ„ํŠผ ํ™œ์„ฑํ™”๋˜๋Š” ๋ฒ„๊ทธ ์ƒํƒœ๊ฐ’ ์กฐ์ •, submit๋กœ์ง FIXMEํƒœ๊ทธ
anyl92 Sep 22, 2024
afd7f15
style: fix lint warning
anyl92 Sep 22, 2024
048725d
feat: ThemeInfo UI ๋ฐ ContentArea ๋‚ด ํด๋”๊ตฌ์กฐ ์ •๋ฆฌ
anyl92 Sep 22, 2024
853b901
feat: ThemeInfo query, interaction ์ ์šฉ / fix resetCreateTheme bug / fiโ€ฆ
anyl92 Sep 22, 2024
cd53400
feat: textfield animation ์ ์šฉ ๋ฐ ์ƒํƒœ๋ถ„๊ธฐ ์ฝ”๋“œ ํ†ตํ•ฉ
anyl92 Sep 26, 2024
cb0927b
feat: ์ž‘์—… ํ•ฉ์น˜๊ธฐ
lgrin-byte Sep 26, 2024
345bd7e
feat: theme router์ฒ˜๋ฆฌ
lgrin-byte Sep 26, 2024
ffe056e
feat: css๋ณ‘ํ•ฉ
lgrin-byte Sep 26, 2024
1971484
feat: ์ˆ˜์ • ๋ชจ๋‹ฌ ์—ฐ๊ฒฐ
lgrin-byte Sep 26, 2024
a9e37e8
feat: ๋‹ค์ด์–ผ๋กœ๊ทธ ์ˆ˜์ •
lgrin-byte Sep 27, 2024
5b940b2
fix: css ๊ฒน์น˜๋Š” ์ด๋ฆ„ ๋ณ€๊ฒฝ, createTheme.ts ํŒŒ์ผ ๊ฒฝ๋กœ ์ด๋™, textfield ํƒ€์ž… ์ˆ˜์ • ๋ฐ ๊ฒฝ๋กœ ์ด๋™
anyl92 Sep 27, 2024
2bd5153
fix: ์ดˆ๊ธฐ errorText ๋…ธ์ถœ ๋ฒ„๊ทธ ์ˆ˜์ •
anyl92 Sep 27, 2024
01da2dc
feat: ์‚ญ์ œ, ์ˆ˜์ • ๋‹ค์ด์–ผ๋กœ๊ทธ ์—ฐ๊ฒฐ
lgrin-byte Sep 27, 2024
f5857fa
fix: ํƒ€์ž… ์—๋Ÿฌ ์ˆ˜์ •
lgrin-byte Sep 27, 2024
0366199
feat: ํ…Œ๋งˆ ์ถ”๊ฐ€ url path ๋ณ€๊ฒฝ, postTheme response ํƒ€์ž… ์ˆ˜์ •, ์ƒˆ ํ…Œ๋งˆ ์ถ”๊ฐ€ ํด๋ฆญ admin-nโ€ฆ
anyl92 Sep 27, 2024
9220cc7
fix: ํ…Œ๋งˆ ์ˆ˜์ • ์‹œ hover ๋ฎ์ด๋Š” ๋ฒ„๊ทธ ํ”ฝ์Šค
anyl92 Sep 27, 2024
07da13b
feat: ๋”ค์ฒ˜๋ฆฌ
lgrin-byte Sep 27, 2024
e20a4e2
feat: key๊ฐ’ ์ถ”๊ฐ€
lgrin-byte Sep 28, 2024
1a667ca
feat: ์™ธ๋ถ€ ํด๋ฆญ ์‹œ ๋‹ซํžˆ๋„๋ก ์ˆ˜์ •
lgrin-byte Sep 28, 2024
805a6f1
feat: build์—๋Ÿฌ ํ•ด๊ฒฐ
lgrin-byte Sep 28, 2024
83a5b98
feat: ๋ผ์šฐํ„ฐ ์ˆ˜์ •
lgrin-byte Sep 28, 2024
8697812
style: ๋”ค์ฒ˜๋ฆฌ ์ˆ˜์ •
lgrin-byte Sep 28, 2024
4ee2b81
feat: ํ…Œ๋งˆ ์ถ”๊ฐ€ ์‹œ ํ† ์ŠคํŠธ ํŒ์—…
lgrin-byte Sep 28, 2024
11e806d
feat: ์‚ญ์ œ ๊ธฐ๋Šฅ ๋น„ํ™œ์„ฑํ™” ์ถ”๊ฐ€
lgrin-byte Sep 28, 2024
7e8296b
feat: ์ƒˆ ํ…Œ๋งˆ ์ถ”๊ฐ€ํ•˜๊ธฐ ๋ฒ„ํŠผ ํ™œ์„ฑํ™”
lgrin-byte Sep 28, 2024
d83beb8
fix: ๋กค๋ฐฑ
lgrin-byte Sep 28, 2024
31d9c4f
fix: ํ…Œ๋งˆ ๋ชจ๋‘ ์‚ญ์ œ ์‹œ ์ƒˆ ํ…Œ๋งˆ ์ถ”๊ฐ€ ํ™”๋ฉด์œผ๋กœ ์ด๋™, ํ…Œ๋งˆ ์ˆ˜์ • ์‹œ ๋ฌธ๊ตฌ ๋ณ€๊ฒฝ, ๋„์–ด์“ฐ๊ธฐ css ํ‘œ์‹œ, ํ…Œ๋งˆ ์ˆ˜์ • ์‹œ โ€ฆ
anyl92 Sep 28, 2024
43fdd52
fix: ๋นŒ๋“œ์—๋Ÿฌ์ˆ˜์ •
lgrin-byte Sep 28, 2024
a0a0f29
Merge pull request #67 from Next-Room/feat/admin-new๋ณ‘ํ•ฉ
lgrin-byte Sep 28, 2024
3174504
fix: ํƒ€์ž…์—๋Ÿฌ ์ˆ˜์ •
lgrin-byte Sep 29, 2024
b1069d2
style: fix ์ž…๋ ฅ ํ…์ŠคํŠธ ์ƒ‰์ƒ ๋ฏธ์ ์šฉ
anyl92 Sep 29, 2024
dc74acd
fix: ํ…Œ๋งˆ ์ถ”๊ฐ€ ๋ฒ„ํŠผ disabled ์ฒ˜๋ฆฌ / feat: textfield์—์„œ keydown enter ์‹œ submit ์ ์šฉ
anyl92 Sep 29, 2024
e00edec
style: ์‚ฌ์ด๋“œ๋ฐ” ํ…Œ๋งˆ์ด๋ฆ„ white-space ์ˆ˜์ •, ๋†’์ด fit-content ์ ์šฉ
anyl92 Sep 29, 2024
c20956d
style: ํ…Œ๋งˆ ์ˆ˜์ • ์‹œ ๋ฌธ๊ตฌ ๋ณ€๊ฒฝ
anyl92 Sep 29, 2024
90df3ae
style: x๋ฒ„ํŠผ ํ…์ŠคํŠธ์™€ ์ค‘์•™์ •๋ ฌ
anyl92 Sep 29, 2024
77c3189
feat: ๊ตฌ๋… ์•Œ์•„๋ณด๊ธฐ ๋ฒ„ํŠผ์— ๋…ธ์…˜ ๋งํฌ ์—ฐ๊ฒฐ
anyl92 Sep 29, 2024
c5035a0
feat: ์‹œ๊ฐ„, ํžŒํŠธ limit ์„ค์ • ๋ฐ -, + ๊ธฐํ˜ธ ์‚ฌ์šฉ ๋ฐฉ์ง€
anyl92 Sep 29, 2024
3fd9091
fix: theme add submit ์˜ค๋ฅ˜ ํ”ฝ์Šค
anyl92 Sep 29, 2024
1ea5b44
style: ํ•ด์ƒ๋„ ์žฌ์ ์šฉ, feat: ํ…์ŠคํŠธํ•„๋“œ ํฌ์ปค์Šค ์•„์›ƒ ์‹œ ์—๋Ÿฌํ…์ŠคํŠธ ์‚ฌ๋ผ์ง€๊ฒŒ
anyl92 Oct 1, 2024
66e42b2
feat: ์ƒˆ ํ…Œ๋งˆ ์ถ”๊ฐ€ ์ž…๋ ฅ๊ฐ’ ๊ฒ€์ฆ ๋กœ์ง ์ถ”๊ฐ€
anyl92 Oct 1, 2024
17a5045
fix: ์ˆ˜์ • ํ›„ router ์ตœ์ƒ์œ„ ํ…Œ๋งˆ๋กœ ๊ฐ€๋Š” ํ˜„์ƒ ์ˆ˜์ •
lgrin-byte Oct 1, 2024
1aee14a
fix: ์—”ํ„ฐ ํด๋ฆญ ์‹œ ๋ชจ๋‹ฌ ์ƒ์„ฑ ๋ง‰๊ธฐ
lgrin-byte Oct 1, 2024
898599d
Merge pull request #68 from Next-Room/feat/theme-qa
lgrin-byte Oct 1, 2024
bb46330
fix: ์ˆ˜์ • ํ›„ router ์ตœ์ƒ์œ„ ํ…Œ๋งˆ๋กœ ๊ฐ€๋Š” ํ˜„์ƒ ์ˆ˜์ •
lgrin-byte Oct 1, 2024
7766034
fix: ๋ผ์šฐํ„ฐ ์ˆ˜์ •
lgrin-byte Oct 1, 2024
0e57a0c
fix: ๋ชจ๋‹ฌ ์—”ํ„ฐ ์ƒ์„ฑ ๋ง‰๊ธฐ
lgrin-byte Oct 1, 2024
6b70f98
Merge branch 'feat/theme-qa' into develop
lgrin-byte Oct 1, 2024
46e390d
fix: ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋ผ์šฐํ„ฐ ๋ถ„๊ธฐ์ฒ˜๋ฆฌ
lgrin-byte Oct 1, 2024
c26b018
Merge branch 'feat/theme-qa' into develop
lgrin-byte Oct 1, 2024
0c97866
fix: ์˜์กด์„ฑ ์ œ๊ฑฐ
lgrin-byte Oct 1, 2024
aa7780b
Merge branch 'feat/theme-qa' into develop
lgrin-byte Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-props-no-spreading": "off",
"jsx-a11y/label-has-associated-control": [
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const preview = {
values: [
{
name: "main",
value: "#000000",
value: "#1A1B1B",
},
{
name: "gray",
Expand Down
88 changes: 88 additions & 0 deletions app/(shared)/(ThemeTextField)/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import React from "react";
import "./textField.modules.sass";
import classNames from "classnames";

import { useTextField } from "./useTextField";
import { ThemeInfoTextFieldType } from "./TextFieldType";

export default function ThemeTextField({
id,
tabIndex,
title,
content,
infoText,
inputType,
inputPlaceholder,
checkErrorText,
}: ThemeInfoTextFieldType) {
const {
inputValue,
isFocus,
setIsFocus,
errorText,
inputRef,
handleInputChange,
handleInputBlur,
} = useTextField({ id, content, checkErrorText });

return (
<div tabIndex={isFocus ? -1 : tabIndex} onFocus={() => setIsFocus(true)}>
<button
className={classNames("theme-textfield", {
focus: isFocus,
filled: inputValue && !isFocus,
error: errorText,
})}
type="button"
tabIndex={-1}
>
<div
className={classNames("theme-textfield-title", {
focus: isFocus,
filled: inputValue,
error: errorText,
focus__ani: isFocus && !inputValue,
focus__removeani: inputRef.current,
})}
tabIndex={-1}
>
{title}
</div>
{(errorText || isFocus) && (
<input
ref={inputRef}
className={classNames("theme-textfield-input", {
error: errorText,
})}
type={inputType}
value={inputValue}
placeholder={inputPlaceholder}
onChange={handleInputChange}
onBlur={handleInputBlur}
tabIndex={tabIndex}
/>
)}
{inputValue && !(errorText || isFocus) && (
<div className="theme-textfield-input filled" tabIndex={-1}>
{inputValue}
</div>
)}
</button>
{errorText && (
<div className="theme-textfield-text error" tabIndex={-1}>
{errorText}
</div>
)}
{infoText && (
<div
className={classNames("theme-textfield-text", {
filled: inputValue,
})}
tabIndex={-1}
>
{infoText}
</div>
)}
</div>
);
}
12 changes: 12 additions & 0 deletions app/(shared)/(ThemeTextField)/TextFieldType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type ValidationFunction<T> = (value: T) => string;

export type ThemeInfoTextFieldType = {
id: "title" | "timeLimit" | "hintLimit";
tabIndex?: number;
title?: string;
content: string;
infoText?: string;
inputType?: string;
inputPlaceholder?: string;
checkErrorText?: ValidationFunction<unknown>;
};
92 changes: 92 additions & 0 deletions app/(shared)/(ThemeTextField)/textField.modules.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
@import '../../style/variables'
@import '../../style/mixins'
@import '../../style/button'

.theme-textfield
width: 100%
height: fit-content
box-sizing: border-box
border-radius: 8px
display: flex

background-color: $color-sub1
border: 1px solid $color-white20
padding: 30px 22px
cursor: pointer
&.focus
background-color: $color-black
border: 1px solid $color-white
padding: 19.5px 20px
flex-direction: column
gap: 4px
cursor: text
&.filled
background-color: $color-main
border: 1px solid $color-white20
padding: 19.5px 20px
flex-direction: column
gap: 4px
cursor: pointer
&.error
border: 1px solid $color-semantic100
padding: 19.5px 20px
flex-direction: column
gap: 4px
cursor: text
&:hover
background-color: $color-black

.theme-textfield-title
@include body16R
color: $color-white70
&.focus
@include body12R
color: $color-white70
&__ani
animation: fadeIn 0.1s ease-in
&__removeani
animation: none
&.filled
@include body12R
color: $color-white70
&.error
@include body12R
color: $color-semantic100

@keyframes fadeIn
from
transform: translateY(10px)
to
transform: translateY(0)
// @keyframes fadeOut
// from
// transform: translateY(10px)
// to
// transform: translateY(0)

.theme-textfield-text
margin: 4px 0 0 16px
cursor: default

@include body12R
color: $color-white70
&.filled
color: $color-white70
&.error
color: $color-semantic100

.theme-textfield-input
text-align: left
width: 100%
border: none
padding: 0
background-color: inherit
@include body16R
color: $color-white50
&:focus
outline: none
color: $color-white
&.filled
color: $color-white
&.error
color: $color-white
72 changes: 72 additions & 0 deletions app/(shared)/(ThemeTextField)/useTextField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { ChangeEvent, FocusEvent, useEffect, useRef, useState } from "react";
import { useCreateTheme } from "@/components/atoms/createTheme.atom";
import { ThemeInfoTextFieldType } from "./TextFieldType";

export const useTextField = ({
id,
content,
checkErrorText,
}: ThemeInfoTextFieldType) => {
const [inputValue, setInputValue] = useState<string>(content || "");
const [isFocus, setIsFocus] = useState<boolean>(false);
const [errorText, setErrorText] = useState<string>("");
const inputRef = useRef<HTMLInputElement>(null);
const [, setCreateTheme] = useCreateTheme();

useEffect(() => {
if (errorText) return;
setCreateTheme((prev) => ({
...prev,
[id]: inputValue,
}));
}, [inputValue, id, setCreateTheme, errorText]);

useEffect(() => {
if (!isFocus || !inputRef.current) {
setErrorText("");
return;
}
inputRef.current.focus();
}, [isFocus]);

const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
const cur = e.target.value;
if (cur.length > 1 && cur.length === cur.split("0").length - 1) {
setInputValue("0");
return;
}
const error = checkErrorText ? checkErrorText(cur) : "";
if (error) {
setErrorText(error);
setInputValue(inputValue);
return;
}
setErrorText("");
setInputValue(cur);
};

const handleInputBlur = (e: FocusEvent<HTMLInputElement>) => {
if (
!e.relatedTarget ||
(e.relatedTarget.className !== "theme-info focus" &&
e.relatedTarget.className !== "theme-info error")
) {
setIsFocus(false);
return;
}
inputRef.current?.focus();
setIsFocus(true);
};

return {
inputValue,
isFocus,
setIsFocus,
errorText,
inputRef,
handleInputChange,
handleInputBlur,
};
};

export default useTextField;
35 changes: 35 additions & 0 deletions app/admin-new/(components)/ContentArea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from "react";
import { useModalStateValue } from "@/components/atoms/modals.atom";
import { useSearchParams } from "next/navigation";
import CreateTheme from "./CreateTheme/Container";
import ThemeInfo from "./ThemeInfo/Container";

export default function ContentArea() {
const modals = useModalStateValue();
const searchParams = useSearchParams();
const params = new URLSearchParams(searchParams.toString()).toString();

return (
<div className="content-area" key={params}>
{params ? (
<>
<ThemeInfo />
{modals.map((modal, index) => {
const { Component, props } = modal;
return (
<div className={`modal-${index}`} key={`${params}`}>
<Component {...props} />
</div>
);
})}
</>
) : (
<CreateTheme />
)}
</div>
);
}

ContentArea.defaultProps = {
type: "", // ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •
};
42 changes: 42 additions & 0 deletions app/admin-new/(components)/CreateTheme/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { FormEvent } from "react";
import "../../(style)/createTheme.modules.sass";
import { useRouter } from "next/navigation";
import { usePostTheme } from "@/mutations/postTheme";
import { useCreateThemeValue } from "@/components/atoms/createTheme.atom";
import { useSelectedThemeWrite } from "@/components/atoms/selectedTheme.atom";
import CreateThemeTitle from "./CreateThemeTitle";
import CreateThemeBody from "./CreateThemeBody";
import CreateThemeAddButton from "./CreateThemeAddButton";

export default function CreateTheme() {
const router = useRouter();
const createTheme = useCreateThemeValue();
const setSelectedTheme = useSelectedThemeWrite();
const { mutateAsync: postTheme } = usePostTheme();

const handleKeyDownSubmit = async (e: FormEvent) => {
e.preventDefault();
const isDisabled =
(!(createTheme.title && createTheme.timeLimit && createTheme.hintLimit) &&
createTheme.timeLimit < 1) ||
createTheme.timeLimit > 10000 ||
(createTheme.hintLimit && createTheme.hintLimit > 1000);
if (isDisabled) {
return;
}
const response = await postTheme(createTheme);
const { id } = response.data.data;
if (id) {
setSelectedTheme(createTheme);
router.push(`/admin-new?themeId=${encodeURIComponent(id)}`);
}
};

return (
<form className="create-theme" onSubmit={handleKeyDownSubmit}>
<CreateThemeTitle />
<CreateThemeBody />
<CreateThemeAddButton />
</form>
);
}
23 changes: 23 additions & 0 deletions app/admin-new/(components)/CreateTheme/CreateThemeAddButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useCreateThemeValue } from "@/components/atoms/createTheme.atom";
import classNames from "classnames";

export default function CreateThemeAddButton() {
const createTheme = useCreateThemeValue();
const isDisabled = !(
createTheme.title &&
createTheme.timeLimit &&
createTheme.hintLimit
);

return (
<button
type="submit"
className={classNames("create-theme__add-button", {
disable: isDisabled,
})}
disabled={isDisabled}
>
ํ…Œ๋งˆ ์ถ”๊ฐ€
</button>
);
}
Loading