File tree Expand file tree Collapse file tree 6 files changed +69
-6
lines changed
components/common/PasswordInput Expand file tree Collapse file tree 6 files changed +69
-6
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ import { ReactComponent as EyeIcon } from '../../../assets/Eye.svg' ;
4+ import { ReactComponent as EyeHiddenIcon } from '../../../assets/EyeHidden.svg' ;
5+ import * as S from './styled' ;
6+
7+ interface PasswordInputProps {
8+ type : string ;
9+ isFillter : boolean ;
10+ setPassword : any ;
11+ setPasswordFilter : any ;
12+ placeholder : string ;
13+ }
14+
15+ export const PasswordInput : React . FC < PasswordInputProps > = ( {
16+ type,
17+ setPassword,
18+ placeholder,
19+ setPasswordFilter,
20+ isFillter,
21+ } ) => (
22+ < S . PasswordInputContainer >
23+ < S . Input
24+ type = { type }
25+ onChange = { ( text ) => {
26+ setPassword ( text . target . value . replace ( / ( \s * ) / g, '' ) ) ;
27+ } }
28+ placeholder = { placeholder }
29+ />
30+ < div
31+ onClick = { ( ) => setPasswordFilter ( ! isFillter ) }
32+ style = { {
33+ zIndex : 10 ,
34+ width : '3rem' ,
35+ height : '3rem' ,
36+ marginRight : '1.2rem' ,
37+ } }
38+ >
39+ { isFillter ? < EyeHiddenIcon /> : < EyeIcon /> }
40+ </ div >
41+ </ S . PasswordInputContainer >
42+ ) ;
Original file line number Diff line number Diff line change 11import styled from '@emotion/styled' ;
22
3- export const PasswordInput = styled . input `
3+ export const PasswordInputContainer = styled . div `
4+ width: 100%;
5+ height: 5rem;
6+ margin-top: 2rem;
7+ position: relative;
8+ display: flex;
9+ align-items: center;
10+ justify-content: flex-end;
11+ ` ;
12+
13+ export const Input = styled . input `
14+ position: absolute;
15+ z-index: 1;
416 border: 0.4rem solid var(--color-border);
517 background-color: var(--color-backgorund-black);
618 color: var(--color-text-placeholder);
719 border-radius: 1rem;
820 outline: none;
921 width: 100%;
10- height: 5rem ;
22+ height: 100% ;
1123 padding-left: 1.2rem;
1224 font-size: 1.8rem;
1325 font-weight: 700;
14- margin-top: 2rem;
26+
1527 &::-webkit-input-placeholder {
1628 color: var(--color-text-placeholder);
1729 }
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ export const CheckPasswordPage: React.FC = () => {
5050 } )
5151 . catch ( ( err ) => {
5252 console . log ( err ) ;
53+ setPassword ( '' ) ;
5354 toast . error ( '비밀번호를 다시 확인해주세요...' , {
5455 autoClose : 1000 ,
5556 position : toast . POSITION . BOTTOM_RIGHT ,
@@ -93,6 +94,7 @@ export const CheckPasswordPage: React.FC = () => {
9394 </ FileBox >
9495 < S . PasswordInputSection >
9596 < S . CheckPasswordInput
97+ value = { password }
9698 onKeyPress = { ( e : any ) => {
9799 if ( e . key === 'Enter' ) {
98100 passwordCheck ( ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export const MainPage: React.FC = () => {
2828 const [ expireTimeBoolean , setExpireTimeBoolean ] = useState ( false ) ;
2929 const [ downloadCountBoolean , setDownloadCountBoolean ] = useState ( false ) ;
3030 const [ passwordBoolean , setPasswordBoolean ] = useState ( false ) ;
31+ const [ passwordFilter , setPasswordFilter ] = useState ( true ) ;
3132
3233 const [ expireTime , setExpireTime ] = useState ( 1 ) ;
3334 const [ downloadCount , setDownloadCount ] = useState ( 100 ) ;
@@ -98,6 +99,7 @@ export const MainPage: React.FC = () => {
9899 autoClose : 3000 ,
99100 position : toast . POSITION . BOTTOM_RIGHT ,
100101 } ) ;
102+ setUploading ( true ) ;
101103 } ) ;
102104 } else {
103105 toast . error ( '파일을 선택해주세요!' , {
@@ -159,9 +161,10 @@ export const MainPage: React.FC = () => {
159161 ) }
160162 { passwordBoolean && (
161163 < PasswordInput
162- onChange = { ( text ) => {
163- setPassword ( text . target . value . replace ( / ( \s * ) / g, '' ) ) ;
164- } }
164+ type = { passwordFilter ? 'password' : 'text' }
165+ isFillter = { passwordFilter }
166+ setPassword = { setPassword }
167+ setPasswordFilter = { setPasswordFilter }
165168 placeholder = "비밀번호를 입력해주세요."
166169 />
167170 ) }
You can’t perform that action at this time.
0 commit comments