-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FE] 인풋 컴포넌트 디자인 수정 및 로그인 페이지 디자인 수정 (#417)
* chore: ios 기기에서 버튼 텍스트 색상이 파란색으로 보였던 문제 해결 * chore: BottomFixedButton 높이 수정 * feat: floating 스타일, 타입 추가 * feat: FloatingInput 구현 - label이 인풋 태그 내부에 위치하도록 relative, absolute 활용 - focus 상태를 관리 * feat: 어떤 입력 Field 인지 나타내는 Title 컴포넌트 생성 - label과는 다른 역할을 한다는 생각을 바탕으로, FieldLabel과 마크업과 스타일이 동일하지만 추가로 하나의 컴포넌트를 추가로 생성 * refactor: FloatingInput을 사용해서 약속을 생성하는 것으로 변경 * chore: DESCRIPTION, ERROR_MESSAGE를 구분 * feat: 스크롤을 막는 컴포넌트 구현 - 모바일 환경에서만 스크롤을 막으면 되기 때문에, 터치 이벤트로 인한 스크롤만 막도록 구현 * refactor: 약속 참여자 로그인 페이지 로직, 스타일 수정 - FloatingInput으로 수정 - useAttendeeLogin 커스텀 훅 활용 - 필드가 페이지 상단에 위치하도록 변경 * refactor: 도메인 정책 변경으로 인한, 1년 뒤의 약속을 생성하려고 하는 경우 토스트 메시지로 알려주는 로직 추가 * design: css 컨벤션을 맞추기 위해 rem으로 수정 * refactor: FloatingLabelInput으로 컴포넌트명 수정, 불필요햔 isFocused 상태 제거 * chore: 컴포넌트명 변경 사항 반영, 버튼 텍스트 상수화 파일명 수정 * chore: 직관적인 함수명을 사용하는 것으로 수정 * chore: IOS 기기에서 드롭다운 텍스트가 파란색으로 보이는 문제 해결 * chore: css 선언 순서 수정 * refactor: 달(Month)를 이동시키는 함수 추상화 * test: 1년 범위를 벗어난 경우 토스트 UI를 활용해서 피드백을 전달하는 책임 테스트 추가 * chore: 테스트 환경에서 절대경로를 인식해야 하는 폴더 추가, svg를 자바스크립트 모듈로 바라볼 수 있도록 설정 추가 * design: 바텀고정버튼 높이 수정 변경 반영 * chore: 불필요한 예외 처리 로직 제거
- Loading branch information
Showing
30 changed files
with
468 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
frontend/src/components/FloatingInput/FloatingLabelInput.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import FloatingLabelInput from '.'; | ||
|
||
const meta = { | ||
title: 'Components/Inputs/FloatingLabelInput', | ||
component: FloatingLabelInput, | ||
argTypes: { | ||
label: { control: 'text' }, | ||
isError: { control: 'boolean' }, | ||
}, | ||
} satisfies Meta<typeof FloatingLabelInput>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
label: '낙타해리빙봉', | ||
placeholder: '송재석최현웅김윤경', | ||
isError: false, | ||
}, | ||
}; |
42 changes: 42 additions & 0 deletions
42
frontend/src/components/FloatingInput/FloatingLabelInput.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import theme from '@styles/theme'; | ||
|
||
export const s_floatingLabelContainer = (isError: boolean) => css` | ||
position: relative; | ||
display: inline-block; | ||
width: 100%; | ||
color: ${isError ? '#EB1E1E' : '#71717a'}; | ||
&:focus-within label { | ||
color: ${isError ? '#EB1E1E' : theme.colors.pink.medium}; | ||
} | ||
`; | ||
|
||
export const s_floatingLabelInput = (isError: boolean) => css` | ||
appearance: none; | ||
box-shadow: ${isError ? `0 0 0 0.1rem #EB1E1E` : `0 0 0 0.1rem #71717a`}; | ||
transition: box-shadow 0.3s; | ||
&::placeholder { | ||
color: #71717a; | ||
} | ||
&:focus { | ||
box-shadow: ${isError | ||
? `0 0 0 0.1rem #EB1E1E` | ||
: `0 0 0 0.1rem ${theme.colors.pink.mediumLight}`}; | ||
} | ||
`; | ||
|
||
export const s_floatingLabel = () => css` | ||
position: absolute; | ||
top: 0.4rem; | ||
left: 1em; | ||
${theme.typography.captionMedium}; | ||
background: transparent; | ||
transition: color 0.3s; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { InputProps } from '@components/_common/Input'; | ||
import Input from '@components/_common/Input'; | ||
|
||
import { | ||
s_floatingLabel, | ||
s_floatingLabelContainer, | ||
s_floatingLabelInput, | ||
} from './FloatingLabelInput.styles'; | ||
|
||
interface FloatingLabelInputProps extends InputProps { | ||
label: string; | ||
isError: boolean; | ||
} | ||
export default function FloatingLabelInput({ | ||
label, | ||
placeholder, | ||
isError, | ||
...props | ||
}: FloatingLabelInputProps) { | ||
return ( | ||
<div css={s_floatingLabelContainer(isError)}> | ||
<label css={s_floatingLabel} htmlFor={label}> | ||
{label} | ||
</label> | ||
<Input | ||
variant="floating" | ||
css={s_floatingLabelInput(isError)} | ||
placeholder={placeholder} | ||
id={label} | ||
{...props} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import { useEffect, useRef } from 'react'; | ||
|
||
export default function ScrollBlock({ children }: PropsWithChildren) { | ||
const contentRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
const preventTouchMove = (e: TouchEvent) => { | ||
e.preventDefault(); | ||
}; | ||
|
||
// 터치 이벤트를 사용해서 스크롤을 할 경우, 해당 스크롤을 막는다는 것을 브라우저에게 명시적으로 알려주기 위해서 passive 속성 추가(@해리) | ||
document.addEventListener('touchmove', preventTouchMove, { passive: false }); | ||
|
||
return () => { | ||
document.removeEventListener('touchmove', preventTouchMove); | ||
}; | ||
}, []); | ||
|
||
return <div ref={contentRef}>{children}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import theme from '@styles/theme'; | ||
|
||
export const s_dropdown = css` | ||
width: fit-content; | ||
height: 2.8rem; | ||
padding: 0.4rem; | ||
color: ${theme.colors.black}; | ||
border-radius: 0.4rem; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const MEETING_BUTTON_TEXTS = { | ||
create: '약속 생성하기', | ||
next: '다음', | ||
register: '등록하러 가기', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const TOAST_MESSAGES = { | ||
OUT_OF_ONE_YEAR_RANGE: '최대 1년뒤의 약속만 생성할 수 있어요', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
|
||
import ToastProvider from '@contexts/ToastProvider'; | ||
|
||
// 필요한 _Provider 들은 유동적으로 추가해서 테스트 환경에서 사용할 수 있어요(@해리) | ||
export default function Providers({ children }: PropsWithChildren) { | ||
return <ToastProvider>{children}</ToastProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { RenderOptions } from '@testing-library/react'; | ||
import { renderHook } from '@testing-library/react'; | ||
|
||
import Providers from './Providers'; | ||
|
||
export default function render<T>(callback: () => T, options?: Omit<RenderOptions, 'wrapper'>) { | ||
return renderHook(callback, { | ||
wrapper: Providers, | ||
...options, | ||
}); | ||
} |
Oops, something went wrong.