-
Notifications
You must be signed in to change notification settings - Fork 0
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
[FE] fix: 꿀조합 이름, 닉네임 글자수 제한 #625
Changes from 4 commits
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,48 @@ | ||
import { Heading, Spacing, Text, useTheme } from '@fun-eat/design-system'; | ||
import type { ChangeEventHandler } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { Input } from '@/components/Common'; | ||
|
||
const MIN_LENGTH = 1; | ||
const MAX_LENGTH = 10; | ||
|
||
interface MemberModifyInputProps { | ||
nickname: string; | ||
modifyNickname: ChangeEventHandler<HTMLInputElement>; | ||
} | ||
|
||
const MemberModifyInput = ({ nickname, modifyNickname }: MemberModifyInputProps) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<MemberModifyInputContainer> | ||
<Heading as="h2" size="xl" tabIndex={0}> | ||
닉네임 | ||
</Heading> | ||
<NicknameStatusText color={theme.textColors.info} tabIndex={0}> | ||
{nickname.length} / {MAX_LENGTH} | ||
</NicknameStatusText> | ||
<Spacing size={12} /> | ||
<Input | ||
value={nickname} | ||
customWidth="100%" | ||
onChange={modifyNickname} | ||
minLength={MIN_LENGTH} | ||
maxLength={MAX_LENGTH} | ||
/> | ||
</MemberModifyInputContainer> | ||
); | ||
}; | ||
|
||
export default MemberModifyInput; | ||
|
||
const MemberModifyInputContainer = styled.div` | ||
position: relative; | ||
`; | ||
|
||
const NicknameStatusText = styled(Text)` | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
`; | ||
Comment on lines
+40
to
+48
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. flex box 를 쓸 수도 있을 것 같은데 왜 position으로 했나요? 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. title을 따로 두고 싶었습니다! 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. 아! 하! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as MembersInfo } from './MembersInfo/MembersInfo'; | ||
export { default as MemberReviewList } from './MemberReviewList/MemberReviewList'; | ||
export { default as MemberRecipeList } from './MemberRecipeList/MemberRecipeList'; | ||
export { default as MemberModifyInput } from './MemberModifyInput/MemberModifyInput'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,59 @@ | ||
import { Heading, Spacing } from '@fun-eat/design-system'; | ||
import { Heading, Spacing, Text, useTheme } from '@fun-eat/design-system'; | ||
import type { ChangeEventHandler } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { Input } from '@/components/Common'; | ||
import { useRecipeFormActionContext } from '@/hooks/context'; | ||
|
||
const MIN_LENGTH = 1; | ||
const MAX_LENGTH = 15; | ||
interface RecipeNameInputProps { | ||
recipeName: string; | ||
} | ||
|
||
const RecipeNameInput = ({ recipeName }: RecipeNameInputProps) => { | ||
const { handleRecipeFormValue } = useRecipeFormActionContext(); | ||
const theme = useTheme(); | ||
|
||
const handleRecipeName: ChangeEventHandler<HTMLInputElement> = (e) => { | ||
handleRecipeFormValue({ target: 'title', value: e.currentTarget.value }); | ||
}; | ||
|
||
return ( | ||
<> | ||
<RecipeNameInputContainer> | ||
<Heading as="h2" size="xl" tabIndex={0}> | ||
꿀조합 이름 | ||
<RequiredMark aria-label="필수 작성">*</RequiredMark> | ||
</Heading> | ||
<RecipeNameStatusText color={theme.textColors.info} tabIndex={0}> | ||
{recipeName.length} / {MAX_LENGTH} | ||
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. 여기도 '자'를 추가해주세요 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. 옙! |
||
</RecipeNameStatusText> | ||
<Spacing size={12} /> | ||
<Input placeholder="재치있는 이름을 지어주세요!" value={recipeName} onChange={handleRecipeName} /> | ||
</> | ||
<Input | ||
placeholder="재치있는 이름을 지어주세요!" | ||
value={recipeName} | ||
onChange={handleRecipeName} | ||
minLength={MIN_LENGTH} | ||
maxLength={MAX_LENGTH} | ||
/> | ||
</RecipeNameInputContainer> | ||
); | ||
}; | ||
|
||
export default RecipeNameInput; | ||
|
||
const RecipeNameInputContainer = styled.div` | ||
position: relative; | ||
width: 300px; | ||
`; | ||
|
||
const RequiredMark = styled.sup` | ||
color: ${({ theme }) => theme.colors.error}; | ||
`; | ||
|
||
const RecipeNameStatusText = styled(Text)` | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
line-height: 28px; | ||
`; |
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.
'자'를 추가해주실 수 있나요?
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.
옙!