-
Notifications
You must be signed in to change notification settings - Fork 4
[feature] 관리자 모바일 비밀번호 수정 페이지 추가 및 관리자용 공통 inputField 추가 #2039
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
base: develop-fe
Are you sure you want to change the base?
Changes from all commits
531430f
27214cb
55148e5
6150d13
cde81a5
70e7d45
8282d51
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,79 @@ | ||
| import styled from 'styled-components'; | ||
| import { colors } from '@/styles/theme/colors'; | ||
| import { setTypography, typography } from '@/styles/theme/typography'; | ||
|
|
||
| export const Wrapper = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 4px; | ||
| width: 100%; | ||
| `; | ||
|
|
||
| export const Card = styled.div<{ $isError?: boolean }>` | ||
| box-sizing: border-box; | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| padding: 12px 14px; | ||
| gap: 10px; | ||
| width: 100%; | ||
| height: 46px; | ||
| background: ${colors.base.white}; | ||
| border: 1px solid | ||
| ${({ $isError }) => ($isError ? colors.primary[900] : colors.gray[200])}; | ||
| border-radius: 10px; | ||
|
|
||
| &:focus-within { | ||
| border-color: ${({ $isError }) => | ||
| $isError ? colors.primary[900] : colors.gray[800]}; | ||
| } | ||
| `; | ||
|
|
||
| export const Input = styled.input` | ||
| flex: 1; | ||
| min-width: 0; | ||
| border: none; | ||
| outline: none; | ||
| background: transparent; | ||
| ${setTypography(typography.paragraph.p5)}; | ||
| color: ${colors.gray[900]}; | ||
| letter-spacing: -0.02em; | ||
|
|
||
| &::placeholder { | ||
| font-weight: 400; | ||
| color: ${colors.gray[500]}; | ||
| } | ||
| `; | ||
|
|
||
| export const ClearButton = styled.button` | ||
| flex-shrink: 0; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background: none; | ||
| border: none; | ||
| padding: 0; | ||
| cursor: pointer; | ||
|
|
||
| svg { | ||
| width: 18px; | ||
| height: 18px; | ||
| } | ||
| `; | ||
|
|
||
| export const ToggleButton = styled.button` | ||
| flex-shrink: 0; | ||
| background: none; | ||
| border: none; | ||
| padding: 0; | ||
| cursor: pointer; | ||
| ${setTypography(typography.button.button2)}; | ||
| color: ${colors.gray[500]}; | ||
| `; | ||
|
|
||
| export const HelperText = styled.span` | ||
| ${setTypography(typography.button.button2)}; | ||
| color: ${colors.primary[900]}; | ||
| letter-spacing: -0.02em; | ||
| padding: 0 4px; | ||
| `; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { ChangeEvent } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useState } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ClearButtonIcon from '@/assets/images/icons/dark_clear_button_icon.svg?react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import * as Styled from './AdminInputField.styles'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interface AdminInputFieldProps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onChange: (e: ChangeEvent<HTMLInputElement>) => void; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClear?: () => void; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| placeholder?: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type?: 'text' | 'password'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isError?: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| helperText?: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maxLength?: number; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const AdminInputField = ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onChange, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClear, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| placeholder, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type = 'text', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isError, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| helperText, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maxLength, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }: AdminInputFieldProps) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [isFocused, setIsFocused] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [isPasswordVisible, setIsPasswordVisible] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handleClear = (e: React.MouseEvent) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| e.preventDefault(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClear?.(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const inputType = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type === 'password' ? (isPasswordVisible ? 'text' : 'password') : type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Styled.Wrapper> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Styled.Card $isError={isError}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Styled.Input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value={value} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onChange={onChange} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| placeholder={placeholder} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type={inputType} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maxLength={maxLength} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onFocus={() => setIsFocused(true)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onBlur={() => setIsFocused(false)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {type === 'password' ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Styled.ToggleButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type='button' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => setIsPasswordVisible((v) => !v)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isPasswordVisible ? '숨기기' : '보기'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Styled.ToggleButton> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+57
Contributor
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. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 비밀번호 필드에서도
비밀번호 분기에도 수정 예시 {type === 'password' ? (
- <Styled.ToggleButton
- type='button'
- onClick={() => setIsPasswordVisible((v) => !v)}
- >
- {isPasswordVisible ? '숨기기' : '보기'}
- </Styled.ToggleButton>
+ <>
+ {isFocused && value && onClear && (
+ <Styled.ClearButton
+ type='button'
+ onMouseDown={handleClear}
+ aria-label='지우기'
+ >
+ <ClearButtonIcon />
+ </Styled.ClearButton>
+ )}
+ <Styled.ToggleButton
+ type='button'
+ onClick={() => setIsPasswordVisible((v) => !v)}
+ >
+ {isPasswordVisible ? '숨기기' : '보기'}
+ </Styled.ToggleButton>
+ </>
) : (📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isFocused && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClear && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Styled.ClearButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type='button' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onMouseDown={handleClear} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-label='지우기' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ClearButtonIcon /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Styled.ClearButton> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Styled.Card> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isError && helperText && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Styled.HelperText>{helperText}</Styled.HelperText> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Styled.Wrapper> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default AdminInputField; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.