Skip to content

Commit

Permalink
Merge branch 'develop' into feat/#27-pretask-link-upload
Browse files Browse the repository at this point in the history
  • Loading branch information
urjimyu committed Jan 10, 2024
2 parents 09b45e1 + 58cad63 commit 09a8a83
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 30 deletions.
4 changes: 4 additions & 0 deletions public/svg/ic_cancel_circle_final.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/assets/svg/IcCancelCircleFinal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from 'react';
import type { SVGProps } from 'react';
const SvgIcCancelCircleFinal = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' {...props}>
<path fill='#F8F8F8' d='M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0' />
<path
stroke='#868384'
strokeLinecap='round'
strokeWidth={1.5}
d='M15.182 8.818 12 12m0 0-3.182 3.182M12 12l3.182 3.182M12 12 8.818 8.818'
/>
</svg>
);
export default SvgIcCancelCircleFinal;
1 change: 1 addition & 0 deletions src/assets/svg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { default as IcAlertTriangle } from './IcAlertTriangle';
export { default as IcCalender } from './IcCalender';
export { default as IcCancel } from './IcCancel';
export { default as IcCancelCircle } from './IcCancelCircle';
export { default as IcCancelCircleFinal } from './IcCancelCircleFinal';
export { default as IcCheckContained } from './IcCheckContained';
export { default as IcCircle } from './IcCircle';
export { default as IcCirclePink } from './IcCirclePink';
Expand Down
44 changes: 23 additions & 21 deletions src/components/onboarding/step01/Step01.style.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
import styled, { css } from 'styled-components';
import theme from '../../../style/theme';

export const Input = styled.input<{ hasContent: boolean; maxLengthReached: boolean }>`
display: flex;
justify-content: center;
align-items: flex-start;
export const Wrapper = styled.div<{ hasContent: boolean; maxLengthReached: boolean }>`
${({ theme }) => theme.mixin.flexBox('center', 'center')}
width: 100%;
height: 3.6rem;
margin-top: 7.2rem;
border: none;
border-bottom: 0.1rem solid ${theme.colors.G_02};
outline: none;
gap: 0.8rem;
border-bottom: 0.1rem solid ${({ theme }) => theme.colors.G_02};
${(props) =>
props.hasContent &&
css`
border-bottom: 0.1rem solid ${theme.colors.P_06};
border-bottom: 0.1rem solid ${({ theme }) => theme.colors.P_06};
`}
${(props) =>
props.maxLengthReached &&
css`
border-bottom: 0.1rem solid ${theme.colors.G_02};
border-bottom: 0.1rem solid ${({ theme }) => theme.colors.G_02};
`}
`;

input::placeholder {
color: ${theme.colors.G_07};
${theme.fonts.body_06}
}
export const TextField = styled.div`
width: 90%;
`;

&::-webkit-input-placeholder {
color: ${theme.colors.G_07};
${theme.fonts.body_06}
}
export const IconField = styled.div`
width: 10%;
`;

export const Input = styled.input<{ hasContent?: boolean; maxLengthReached?: boolean }>`
${({ theme }) => theme.mixin.flexBox('flex-center', 'center')};
width: 100%;
height: 3.5rem;
border: none;
outline: none;
&:-ms-input-placeholder {
color: ${theme.colors.G_07};
${theme.fonts.body_06}
input::placeholder {
color: ${({ theme }) => theme.colors.G_07};
${({ theme }) => theme.fonts.body_06};
}
`;

Expand Down
34 changes: 25 additions & 9 deletions src/components/onboarding/step01/Step01.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState } from 'react';
import Title from '../../common/title/Title';
import * as S from './Step01.style';
import { IcCancelCircleFinal } from '../../../assets/svg';

const NameInput = () => {
const [text, setText] = useState<string>('');
Expand All @@ -12,19 +13,34 @@ const NameInput = () => {
inputValue.length + unicodeChars <= 10 ? setText(inputValue) : e.preventDefault();
};

// TODO 인풋창에 x 버튼 추가 및 클릭 시 값 삭제

const handleBtnClick = () => {
setText('');
};

return (
<>
<Title title='선물 받을 분의' />
<Title title='이름, 혹은 닉네임을 알려주세요' />
<S.Input
type='text'
onChange={onChange}
maxLength={10}
placeholder='이름을 입력해주세요'
hasContent={text.length > 0}
maxLengthReached={text.length === 10}
/>
<S.Wrapper hasContent={text.length > 0} maxLengthReached={text.length === 10}>
<S.TextField>
<S.Input
type='text'
value={text}
onChange={onChange}
maxLength={10}
placeholder='이름을 입력해주세요'
/>
</S.TextField>
<S.IconField>
{text.length > 0 && (
<IcCancelCircleFinal
style={{ width: '2.4rem', height: '2.4rem' }}
onClick={handleBtnClick}
/>
)}
</S.IconField>
</S.Wrapper>
<S.LetterLength>({text.length}/10)</S.LetterLength>
</>
);
Expand Down

0 comments on commit 09a8a83

Please sign in to comment.