-
Notifications
You must be signed in to change notification settings - Fork 39
[문주영] Sprint10 #228
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
The head ref may contain hidden characters: "Next-\uBB38\uC8FC\uC601-sprint10"
[문주영] Sprint10 #228
Changes from all commits
9fbbcad
ed41393
440f0dd
29cc4e3
5c78dfe
9fd1d95
c2e7727
908c6b8
0e58559
ccdf389
9f2ee47
73f8f8e
d8fc946
449b4e1
ab72738
100500b
6bbc5fd
2bd8cee
f2e6405
94d6b09
169f92e
8cd39fc
a5d57ae
7fe74a0
8be3feb
a95c2fb
1b088b8
45baaad
32a588e
edb28ac
5045e60
7b835bb
24b6a50
16360a2
f5ecffe
1290138
11e8f53
adcc711
024de26
ae9abe8
2094d80
f88f08a
b6630c5
b9c3936
2eaeb0d
8e60fb1
e48f132
17ab33b
b98b568
dadc8a9
b000c53
1734449
e133fef
144bed8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| .btn { | ||
| justify-items: center; | ||
| align-content: center; | ||
| width: 64px; | ||
| height: 64px; | ||
| border-radius: 9999px; | ||
| } | ||
|
|
||
| .btn.plus { | ||
| background-color: var(--slate200); | ||
| } | ||
|
|
||
| .btn.edit { | ||
| border: 2px solid var(--slate900); | ||
| background-color: rgb(from var(--slate900) r g b / 0.5); | ||
| } | ||
|
|
||
| .btn img { | ||
| display: block; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { LabelHTMLAttributes } from "react"; | ||
| import Image from "next/image"; | ||
| import ic_plus from "@/assets/icons/plus_big.svg"; | ||
| import ic_edit from "@/assets/icons/edit.svg"; | ||
| import styles from "./BtnImage.module.css"; | ||
|
|
||
| interface Props extends LabelHTMLAttributes<HTMLLabelElement> { | ||
| mode: "plus" | "edit"; | ||
| } | ||
|
|
||
| export default function BtnImage({ className = "", mode, ...props }: Props) { | ||
| return ( | ||
| <label className={`${styles.btn} ${styles[mode]} ${className}`} {...props}> | ||
| <Image alt={mode} src={mode === "plus" ? ic_plus : ic_edit} /> | ||
| </label> | ||
| ); | ||
| } |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💊 제안 export default function CheckItem({
className = "",
children,
isChecked,
...props
}: Props) {
return (
<Link
className={`${styles["check-list"]} ${
styles[String(isChecked)]
} ${className}`}
{...props}
>
{children}
</Link>
);
}<CheckItem>
<button type="button" onClick={onClick}>
<Image alt="checkbox" src={isChecked ? ic_checked : ic_empty} />
</button>
{item.name}
</CheckItem>또한 button 클릭 시 링크 이동이 되지 않도록 Event.preventDefault 함수를 호출하세요~ |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,10 +1,14 @@ | ||||
| import { HTMLAttributes, MouseEventHandler } from "react"; | ||||
| import { AnchorHTMLAttributes, MouseEventHandler } from "react"; | ||||
| import Image from "next/image"; | ||||
| import Link, { LinkProps } from "next/link"; | ||||
| import ic_checked from "@/assets/icons/checkbox_checked.svg"; | ||||
| import ic_empty from "@/assets/icons//checkbox_empty.svg"; | ||||
| import styles from "./CheckList.module.css"; | ||||
|
|
||||
| interface Props extends HTMLAttributes<HTMLDivElement> { | ||||
| type LinkAttributes = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProps; | ||||
|
|
||||
| interface Props extends LinkAttributes { | ||||
| href: string; | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💊 제안
Suggested change
|
||||
| isChecked: boolean; | ||||
| onButtonClick: MouseEventHandler<HTMLButtonElement>; | ||||
| } | ||||
|
|
@@ -17,7 +21,7 @@ export default function CheckList({ | |||
| ...props | ||||
| }: Props) { | ||||
| return ( | ||||
| <div | ||||
| <Link | ||||
| className={`${styles["check-list"]} ${ | ||||
| styles[String(isChecked)] | ||||
| } ${className}`} | ||||
|
|
@@ -27,6 +31,6 @@ export default function CheckList({ | |||
| <Image alt="checkbox" src={isChecked ? ic_checked : ic_empty} /> | ||||
| </button> | ||||
| {children} | ||||
| </div> | ||||
| </Link> | ||||
| ); | ||||
| } | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| .check-list { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 16px; | ||
| height: 64px; | ||
| border: 2px solid var(--slate900); | ||
| border-radius: 24px; | ||
| } | ||
|
|
||
| .check-list.true { | ||
| background-color: var(--violet200); | ||
| } | ||
|
|
||
| .check-list.false { | ||
| background-color: white; | ||
| } | ||
|
|
||
| .check-list * { | ||
| color: var(--slate900); | ||
| line-height: 23px; | ||
| font-size: 20px; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .check-list button { | ||
| line-height: 0; | ||
| } | ||
|
|
||
| .check-list span { | ||
| z-index: -100; | ||
| position: fixed; | ||
| visibility: hidden; | ||
| white-space: pre; | ||
| } | ||
|
|
||
| .check-list input { | ||
| padding: 0; | ||
| border: 0; | ||
| outline: none; | ||
| background-color: transparent; | ||
| text-decoration: underline; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { HTMLAttributes, useEffect, useRef, useState } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Image from "next/image"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ic_checked from "@/assets/icons/checkbox_checked.svg"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ic_empty from "@/assets/icons//checkbox_empty.svg"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import styles from "./CheckListDetail.module.css"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interface Props extends HTMLAttributes<HTMLDivElement> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defaultIsChecked: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defaultValue: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function CheckListDetail({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className = "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defaultIsChecked = false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defaultValue = "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }: Props) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [value, setValue] = useState(defaultValue ?? ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [isChecked, setIsChecked] = useState(defaultIsChecked); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+19
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💊 제안
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const spanRef = useRef<HTMLSpanElement>(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const inputRef = useRef<HTMLInputElement>(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const width = (spanRef.current?.offsetWidth ?? 0) + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (inputRef.current) inputRef.current.style.width = width + "px"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, [value]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+27
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❗️ 수정요청 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={`${styles["check-list"]} ${ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| styles[String(isChecked)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } ${className}`} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {...props} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button type="button" onClick={() => setIsChecked((prev) => !prev)}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Image alt="checkbox" src={isChecked ? ic_checked : ic_empty} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <input type="hidden" name="isCompleted" value={String(isChecked)} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+38
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💊 제안 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span ref={spanRef}>{value}</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ref={inputRef} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name="name" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value={value} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onChange={(e) => setValue(e.currentTarget.value)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| declare module "*.jpg"; | ||
| declare module "*.png"; | ||
| declare module "*.jpeg"; | ||
| declare module "*.gif"; | ||
| declare module "*.svg"; | ||
| declare module "*.css"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💊 제안
CheckList라는 컴포넌트 명은 "List" 때문에 부적절한 것 같아요. CheckItem 같은 컴포넌트명을 추천드립니다.