Skip to content

Commit

Permalink
Merge pull request #108 from tempfiles-Team/103-각종-편의-개선-사항
Browse files Browse the repository at this point in the history
103 각종 편의 개선 사항
  • Loading branch information
ananjaemin committed Dec 28, 2022
2 parents 52a87b0 + 2b4c1db commit c64ba86
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/assets/Eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/assets/EyeHidden.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions src/components/common/PasswordInput/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';

import { ReactComponent as EyeIcon } from '../../../assets/Eye.svg';
import { ReactComponent as EyeHiddenIcon } from '../../../assets/EyeHidden.svg';
import * as S from './styled';

interface PasswordInputProps {
type: string;
isFillter: boolean;
setPassword: any;
setPasswordFilter: any;
placeholder: string;
}

export const PasswordInput: React.FC<PasswordInputProps> = ({
type,
setPassword,
placeholder,
setPasswordFilter,
isFillter,
}) => (
<S.PasswordInputContainer>
<S.Input
type={type}
onChange={(text) => {
setPassword(text.target.value.replace(/(\s*)/g, ''));
}}
placeholder={placeholder}
/>
<div
onClick={() => setPasswordFilter(!isFillter)}
style={{
zIndex: 10,
width: '3rem',
height: '3rem',
marginRight: '1.2rem',
}}
>
{isFillter ? <EyeHiddenIcon /> : <EyeIcon />}
</div>
</S.PasswordInputContainer>
);
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
import styled from '@emotion/styled';

export const PasswordInput = styled.input`
export const PasswordInputContainer = styled.div`
width: 100%;
height: 5rem;
margin-top: 2rem;
position: relative;
display: flex;
align-items: center;
justify-content: flex-end;
`;

export const Input = styled.input`
position: absolute;
z-index: 1;
border: 0.4rem solid var(--color-border);
background-color: var(--color-backgorund-black);
color: var(--color-text-placeholder);
border-radius: 1rem;
outline: none;
width: 100%;
height: 5rem;
height: 100%;
padding-left: 1.2rem;
font-size: 1.8rem;
font-weight: 700;
margin-top: 2rem;
&::-webkit-input-placeholder {
color: var(--color-text-placeholder);
}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/checkpw/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const CheckPasswordPage: React.FC = () => {
})
.catch((err) => {
console.log(err);
setPassword('');
toast.error('비밀번호를 다시 확인해주세요...', {
autoClose: 1000,
position: toast.POSITION.BOTTOM_RIGHT,
Expand Down Expand Up @@ -93,6 +94,7 @@ export const CheckPasswordPage: React.FC = () => {
</FileBox>
<S.PasswordInputSection>
<S.CheckPasswordInput
value={password}
onKeyPress={(e: any) => {
if (e.key === 'Enter') {
passwordCheck();
Expand Down
9 changes: 6 additions & 3 deletions src/pages/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const MainPage: React.FC = () => {
const [expireTimeBoolean, setExpireTimeBoolean] = useState(false);
const [downloadCountBoolean, setDownloadCountBoolean] = useState(false);
const [passwordBoolean, setPasswordBoolean] = useState(false);
const [passwordFilter, setPasswordFilter] = useState(true);

const [expireTime, setExpireTime] = useState(1);
const [downloadCount, setDownloadCount] = useState(100);
Expand Down Expand Up @@ -98,6 +99,7 @@ export const MainPage: React.FC = () => {
autoClose: 3000,
position: toast.POSITION.BOTTOM_RIGHT,
});
setUploading(true);
});
} else {
toast.error('파일을 선택해주세요!', {
Expand Down Expand Up @@ -159,9 +161,10 @@ export const MainPage: React.FC = () => {
)}
{passwordBoolean && (
<PasswordInput
onChange={(text) => {
setPassword(text.target.value.replace(/(\s*)/g, ''));
}}
type={passwordFilter ? 'password' : 'text'}
isFillter={passwordFilter}
setPassword={setPassword}
setPasswordFilter={setPasswordFilter}
placeholder="비밀번호를 입력해주세요."
/>
)}
Expand Down

0 comments on commit c64ba86

Please sign in to comment.