Skip to content

Commit 6585e3f

Browse files
committed
feat: comment input (#develop)
1 parent 215cb70 commit 6585e3f

File tree

25 files changed

+556
-4971
lines changed

25 files changed

+556
-4971
lines changed

pnpm-lock.yaml

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/ahhachul.com/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ dist-ssr
2525
/test-results/
2626
e2e/playwright-report/
2727
/blob-report/
28-
/playwright/.cache/
28+
/playwright/.cache/

services/ahhachul.com/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@emotion/react": "^11.14.0",
3535
"@emotion/styled": "^11.14.0",
3636
"@hookform/resolvers": "^3.9.1",
37+
"@lexical/link": "^0.27.1",
3738
"@lexical/react": "^0.23.1",
3839
"@lottiefiles/react-lottie-player": "^3.6.0",
3940
"@radix-ui/react-dropdown-menu": "^2.1.4",

services/ahhachul.com/src/apis/request/comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const postComment = async (data: {
77
servicePath: string;
88
postId: number;
99
content: string;
10-
upperCommentId: number;
10+
upperCommentId: number | null;
1111
isPrivate: boolean;
1212
}) => {
1313
const { servicePath, postId, content, upperCommentId, isPrivate } = data;
Lines changed: 15 additions & 0 deletions
Loading

services/ahhachul.com/src/assets/icons/system/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export { default as WarningIcon } from './ic_warning.svg?react';
2020
export { default as ProfileIcon } from './ic_profile.svg?react';
2121
export { default as CommentIcon } from './ic_comment.svg?react';
2222
export { default as ChevronIcon } from './ic_chevron.svg?react';
23+
export { default as CheckboxIcon } from './ic_checkbox.svg?react';
2324
export { default as BookmarkIcon } from './ic_bookmark.svg?react';
2425
export { default as SmallLogeIcon } from './ic_logo_sm.svg?react';
2526
export { default as EllipsisIcon } from './ic_ellipsis.svg?react';
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import { ChangeEvent } from 'react';
2+
3+
import { css } from '@emotion/react';
4+
import styled from '@emotion/styled';
5+
6+
import { CheckboxIcon } from '@/assets/icons/system';
7+
8+
interface CheckboxProps {
9+
checked?: boolean;
10+
disabled?: boolean;
11+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
12+
label?: string;
13+
name?: string;
14+
value?: string;
15+
className?: string;
16+
}
17+
18+
const CheckboxContainer = styled.label<{ disabled?: boolean }>`
19+
display: inline-flex;
20+
align-items: center;
21+
gap: 0.5rem;
22+
cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
23+
user-select: none;
24+
`;
25+
26+
const CheckboxInput = styled.input`
27+
position: absolute;
28+
opacity: 0;
29+
width: 0;
30+
height: 0;
31+
margin: 0;
32+
`;
33+
34+
const CheckboxControl = styled.div<{ checked?: boolean; disabled?: boolean }>`
35+
width: 20px;
36+
height: 20px;
37+
border-radius: 4px;
38+
border: 2px solid #eaeaec;
39+
display: flex;
40+
align-items: center;
41+
justify-content: center;
42+
transition: all 0.2s ease;
43+
background-color: #ffffff;
44+
cursor: pointer;
45+
46+
${({ checked, disabled }) => {
47+
if (checked && !disabled) {
48+
return css`
49+
background-color: #2acf6c;
50+
border-color: #2acf6c;
51+
`;
52+
}
53+
if (checked && disabled) {
54+
return css`
55+
background-color: #b6efdb;
56+
border-color: #b6efdb;
57+
`;
58+
}
59+
if (!checked && disabled) {
60+
return css`
61+
background-color: #f7fdfb;
62+
border-color: #b6efdb;
63+
`;
64+
}
65+
return '';
66+
}}
67+
68+
svg {
69+
color: ${props => (props.disabled ? '#84E4C2' : '#ffffff')};
70+
opacity: ${props => (props.checked ? 1 : 0)};
71+
transition: opacity 0.2s ease;
72+
}
73+
`;
74+
75+
const CheckboxLabel = styled.span<{ disabled?: boolean }>`
76+
color: ${props => (props.disabled ? '#33333E' : '#33333E')};
77+
font-size: 13px;
78+
cursor: pointer;
79+
`;
80+
81+
export default function Checkbox({
82+
checked = false,
83+
disabled = false,
84+
onChange,
85+
label,
86+
name,
87+
value,
88+
className,
89+
...props
90+
}: CheckboxProps) {
91+
return (
92+
<CheckboxContainer disabled={disabled} className={className}>
93+
<CheckboxInput
94+
type="checkbox"
95+
defaultChecked={checked}
96+
disabled={disabled}
97+
onChange={onChange}
98+
name={name}
99+
value={value}
100+
{...props}
101+
/>
102+
<CheckboxControl checked={checked} disabled={disabled}>
103+
<CheckboxIcon />
104+
</CheckboxControl>
105+
{label && <CheckboxLabel disabled={disabled}>{label}</CheckboxLabel>}
106+
</CheckboxContainer>
107+
);
108+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Checkbox } from './Checkbox.component';

0 commit comments

Comments
 (0)