Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat : 포즈픽 페이지 구현 #9

Merged
merged 7 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/images/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/app/(Main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Spacing } from '@/components/Spacing';
export default function MainLayout({ children }: StrictPropsWithChildren) {
return (
<>
<Spacing size={140} />
<Spacing size={120} />
<MainHeader />
{children}
</>
Expand Down
51 changes: 51 additions & 0 deletions src/app/(Main)/pick/components/PickSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use client';

import { BottomFixedButton } from '@/components/Button';
import Image from 'next/image';
import { useState } from 'react';

const countList = ['1인', '2인', '3인', '4인', '5인+'];

export default function PickSection() {
const [countState, setCountState] = useState<string>('1인');

return (
<section className="flex flex-col ">
<div className="my-16 flex h-40 justify-evenly rounded-8 px-20">
{countList.map((count) => (
<CountItem
key={count}
onClick={() => setCountState(count)}
isSelected={count === countState}
count={count}
/>
))}
</div>
<div className="relative h-520 grow bg-black">
<Image src="/images/sample.png" fill alt="image" />
</div>
<BottomFixedButton text="포즈 pick!" className="bg-main-violet text-white" />
</section>
);
}

interface CountItemProps {
isSelected: boolean;
count: string;
onClick: () => void;
}

function CountItem({ isSelected, count, onClick }: CountItemProps) {
return (
<div
className={`flex grow cursor-pointer items-center justify-center first:rounded-l-8 last:rounded-r-8 ${
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우와 tailwind 고수같아요... 짱... 👍🏻

isSelected
? 'border-1 border-main-violet bg-main-violet-bright'
: 'border-1 border-default bg-sub-white'
}`}
onClick={onClick}
>
<h6 className={isSelected ? 'text-main-violet-dark' : ''}>{count}</h6>
</div>
);
}
8 changes: 7 additions & 1 deletion src/app/(Main)/pick/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import PickSection from './components/PickSection';

export default function Pick() {
return <>포즈픽s</>;
return (
<>
<PickSection />
</>
);
}
4 changes: 4 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
display: none;
}

html {
font-size: 4vw;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4vw는 어떻게 나온 기준일까요 ?!
(관용적으로 많이 쓰이는 값인지, 저희 프로젝트에만 적용된건지 ? 궁금합니당)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 폰트사이즈는 아래에 있는 @media(min-width:420px){ }의 범위가 아닌, 즉 440px보다 작을 경우에 적용이 됩니다.

너비가 440px일 때 16px이고, 그 이후로는 vw, 즉 뷰포트 너비에 맞게 font-size또한 작아져야 합니다.

이야기하면서 생각난건데, 정확한 수치는 4vw가 아니겠네요.

440px * x = 16

x = 16/440px = 약 0.036..

이네요. calc를 이용하면 font-size: calc(16vw / 440 * 100);로 표현할 수 있겠네요. 이렇게 수정해서 다음 PR에 올리겠습니다 !

}

@media (min-width: 420px) {
html {
font-size: 16px;
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
return (
<html lang="ko">
<body className="flex h-[100dvh] w-screen touch-none justify-center bg-slate-100 py-px">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전 PR에서 루트 레이아웃에 변경사항이 있었는데 혹시 머지중에 충돌난다면 규성님이 쓰신걸루 해주세요!

<div className="h-full w-full max-w-440 bg-white px-20 text-black drop-shadow-2xl">
<div className="h-full w-full max-w-440 bg-white text-black drop-shadow-2xl">
{children}
</div>
</body>
Expand Down
9 changes: 9 additions & 0 deletions src/components/BottomFixedDiv/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { StrictPropsWithChildren } from '@/types';

export default function BottomFixedDiv({ children }: StrictPropsWithChildren) {
return (
<div className="fixed inset-x-0 bottom-0 mx-auto max-w-440">
<div className="px-20 pb-20">{children}</div>
</div>
);
}
10 changes: 10 additions & 0 deletions src/components/Button/BottomFixedButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import BottomFixedDiv from '../BottomFixedDiv';
import Button, { type ButtonProps } from './Button';

export default function BottomFixedButton({ ...props }: ButtonProps) {
return (
<BottomFixedDiv>
<Button {...props} />
</BottomFixedDiv>
);
}
20 changes: 20 additions & 0 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { ButtonHTMLAttributes, HTMLAttributes, PropsWithChildren } from 'react';

export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
text: string;
type?: 'button' | 'submit';
className?: string;
props?: PropsWithChildren<HTMLAttributes<HTMLButtonElement>>;
}

export default function Button({ text, type = 'button', className, ...props }: ButtonProps) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저희 버튼도 종류가 많아서.. Primary Button으로 따로 이름을 붙이는건 어떨까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 그것도 좋은 방법이 될 거 같아요.

버튼이 다양해서 각 도메인에서 버튼을 커스텀하여 만드는 방법을 생각했지만, 자주 쓰는 primary button은 만들면 좋을 거 같네요.

return (
<button
className={`flex h-60 w-full items-center justify-center rounded-xl py-14 text-center text-16 ${className}`}
type={type}
{...props}
>
<h5>{text}</h5>
</button>
);
}
2 changes: 2 additions & 0 deletions src/components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as Button } from './Button';
export { default as BottomFixedButton } from './BottomFixedButton';
50 changes: 25 additions & 25 deletions styles/theme/colors.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { COLOR } from "../../src/constants/color";

export const colors = {
// bg
"white": COLOR.white,
"sub-white": COLOR.gray[50],
"divider": COLOR.gray[100],
// bg
white: COLOR.white,
'sub-white': COLOR.gray[50],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

큰 상관은 없긴 한데, 요 파일 프리티어로 자동 적용 된 것 같네요..!

divider: COLOR.gray[100],

// border
"default": COLOR.gray[300],
"active": COLOR.gray[900],
"disabled": COLOR.gray[100],
// border
default: COLOR.gray[300],
active: COLOR.gray[900],
disabled: COLOR.gray[100],

// brand colors
"main-violet-light": COLOR.violet[300],
"main-violet": COLOR.violet[500],
"main-violet-dark": COLOR.violet[700],
// brand colors
'main-violet-bright': COLOR.violet[100],
'main-violet-light': COLOR.violet[300],
'main-violet': COLOR.violet[600],
'main-violet-dark': COLOR.violet[700],

// text
"cto": COLOR.black,
"brand": COLOR.violet[500],
"primary":COLOR.gray[900],
"secondary": COLOR.gray[700],
"tertiary": COLOR.gray[500],
"caption": COLOR.gray[400],

// icon
"icon-default": COLOR.gray[800],
"icon-hover": COLOR.gray[600],
"icon-disabled": COLOR.gray[500],
// text
cto: COLOR.black,
brand: COLOR.violet[500],
primary: COLOR.gray[900],
secondary: COLOR.gray[700],
tertiary: COLOR.gray[500],
caption: COLOR.gray[400],

} as const
// icon
'icon-default': COLOR.gray[800],
'icon-hover': COLOR.gray[600],
'icon-disabled': COLOR.gray[500],
} as const;
7 changes: 7 additions & 0 deletions styles/typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ h5 {
letter-spacing: -0.2px;
}

h6 {
font-weight: 500;
font-size: 0.875rem;
line-height: 1.125rem;
letter-spacing: 0;
}

p {
font-weight: 400;
font-size: 1rem;
Expand Down