Skip to content

Commit

Permalink
feat: 비밀번호 입력 컴포넌트 구현 (#13)
Browse files Browse the repository at this point in the history
* feat: 비밀번호 입력 컴포넌트 구현

* refactor: input 타입 변경

* refactor: 함수명 수정,event->e로 네이밍 변경

* refactor: 수정 사항 반영
  • Loading branch information
khj0426 authored Oct 31, 2023
1 parent fd7c287 commit 5f022cc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { default as CloseIcon } from './close.svg?react'
export { default as PassWord } from './password.svg?react'
export { default as PassWordConfirm } from './passwordconfirm.svg?react'
export { default as StarIcon } from './star.svg?react'
export { default as TableSend } from './table_send.svg?react'
export { default as SearchIcon } from './search.svg?react'
Expand Down
4 changes: 4 additions & 0 deletions src/assets/icons/password.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/passwordconfirm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/components/PasswordInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ChangeEvent, ComponentPropsWithoutRef } from 'react'
import { PassWord, PassWordConfirm } from '@/assets/icons'

interface PasswordInputProps
extends Omit<ComponentPropsWithoutRef<'input'>, 'onChange'> {
type: 'password' | 'confirmation'
handlePassWordChange?: (e: ChangeEvent<HTMLInputElement>) => void
disabled?: boolean
placeholder?: string
}

const PassWordInput = ({
type,
placeholder,
disabled,
handlePassWordChange,
...rest
}: PasswordInputProps) => {
return (
<div className="items-center2 relative flex h-fit w-fit flex-row content-center justify-center gap-2 border-2 border-black">
<input
className="input border-0 bg-white pl-8 text-black"
placeholder={placeholder ?? '새 비밀번호 입력'}
disabled={disabled}
onChange={handlePassWordChange}
{...rest}
/>
<i className="flex items-center">
{type === 'password' ? <PassWord /> : <PassWordConfirm />}
</i>
</div>
)
}

export default PassWordInput
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as PassWordInput } from './PasswordInput'
export { default as StarRating } from './StarRating'

Check failure on line 2 in src/components/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"./StarRating"' has no exported member 'default'.
export { default as IconButton } from './IconButton'

Check failure on line 3 in src/components/index.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"./IconButton"' has no exported member 'default'.
export { default as SearchBar } from './SearchBar'
Expand Down

0 comments on commit 5f022cc

Please sign in to comment.