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

Fix : QA 내용 반영하여 수정 #26

Merged
merged 19 commits into from
Aug 24, 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
10 changes: 2 additions & 8 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
addReviewers: true
addAssignees: true
reviewers:
- guesung
- seondal
skipKeywords:
- wip
numberOfReviewers: 0
addReviewers: false
addAssignees: author
5 changes: 5 additions & 0 deletions public/icons/close_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/image-frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/apis/apis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { FilterTagsResponse, PoseFeedResponse, PosePickResponse, PoseTalkResponse } from '.';
import {
FilterTagsResponse,
PoseDetailResponse,
PoseFeedResponse,
PosePickResponse,
PoseTalkResponse,
} from '.';
import publicApi from './config/publicApi';

export const getPosePick = (peopleCount: number) =>
Expand Down
2 changes: 1 addition & 1 deletion src/apis/queries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { UseQueryOptions, useQuery } from '@tanstack/react-query';

import { FilterState } from '@/hooks/useFilterState';
import {
FilterTagsResponse,
PoseFeedResponse,
Expand All @@ -12,6 +11,7 @@ import {
getPosePick,
getPoseTalk,
} from '.';
import { FilterState } from '@/hooks/useFilterState';

export const usePoseDetailQuery = (poseId: number) =>
useQuery(['poseId', poseId], () => getPoseDetail(poseId));
Expand Down
2 changes: 1 addition & 1 deletion src/app/(Main)/components/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Tab() {
<div className="relative border-b-2 border-b-main-violet" />
</>
) : (
<Link className="py-12" href={item.path} as={item.path}>
<Link className="py-12 text-tertiary" href={item.path} as={item.path}>
<h5>{item.title}</h5>
</Link>
)}
Expand Down
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 { StrictPropsWithChildren } from '@/types';
export default function MainLayout({ children }: StrictPropsWithChildren) {
return (
<>
<Spacing size={104} />
<Spacing size={80} />
<MainHeader />
<div className="px-20 py-16">{children}</div>
</>
Expand Down
10 changes: 7 additions & 3 deletions src/app/(Main)/pick/components/PickSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function PickSection() {
};

return (
<section className="flex flex-col px-20">
<section className="flex flex-col">
<div className="flex justify-evenly rounded-8 py-16">
{countList.map((count) => (
<CountItem
Expand All @@ -48,7 +48,7 @@ export default function PickSection() {
<Lottie loop animationData={lottiePick} play style={{ width: '100%', height: '100%' }} />
)}
<Image
src={image || '/images/sample.png'}
src={image || '/images/image-frame.png'}
fill
alt="sample"
priority
Expand All @@ -57,7 +57,11 @@ export default function PickSection() {
/>
</div>

<BottomFixedButton className="bg-main-violet text-white" onClick={handlePickClick}>
<BottomFixedButton
className="bg-main-violet text-white"
onClick={handlePickClick}
disabled={isLoading}
>
{!!image ? '포즈 pick!' : '인원수 선택하고 포즈 pick!'}
</BottomFixedButton>
</section>
Expand Down
14 changes: 9 additions & 5 deletions src/app/(Main)/talk/components/TalkSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import Image from 'next/image';
import { useRef, useState } from 'react';
import Lottie from 'react-lottie-player';

Expand All @@ -13,6 +12,7 @@ import useLoading from '@/hooks/useLoading';
export default function TalkSection() {
const { isLoading: isFirstLoading, stopLoading: stopFirstLoading } = useLoading({
loadingDelay: 3000,
isFirstLoadingInfinite: true,
});
const ref = useRef(null);

Expand All @@ -21,13 +21,14 @@ export default function TalkSection() {
const { isLoading, startLoading } = useLoading({
loadingDelay: 3000,
onStopLoading: () => data && setTalkWord(data.poseWord.content),
initialState: false,
});
const [talkWord, setTalkWord] = useState<string>('포즈로 말해요');
Copy link
Member

Choose a reason for hiding this comment

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

피그마 보시면 텍스트 변경되어 있어요!
포즈로 말해요 -> 제시어에 맞춰\n포즈를 취해요!


const handleTalkClick = () => {
refetch();
stopFirstLoading();
if (isFirstLoading) stopFirstLoading();
startLoading();
refetch();
};

return (
Expand All @@ -41,7 +42,6 @@ export default function TalkSection() {
play
style={{ width: '100%', height: '100%' }}
ref={ref}
onComplete={() => console.log('complete')}
/>
)}
{isLoading && !isFirstLoading && (
Expand All @@ -61,7 +61,11 @@ export default function TalkSection() {
speed={0}
/>
)}
<BottomFixedButton className="bg-main-violet text-white" onClick={handleTalkClick}>
<BottomFixedButton
className="bg-main-violet text-white"
onClick={handleTalkClick}
disabled={isLoading}
>
제시어 뽑기
</BottomFixedButton>
</section>
Expand Down
50 changes: 44 additions & 6 deletions src/app/(Main)/talk/components/TitleSection.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,67 @@
'use client';
import Image from 'next/image';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { Tooltip } from 'react-tooltip';

import { Spacing } from '@/components/Spacing';

export default function TitleSection() {
const [tooltipOpened, setTooltipOpened] = useState<boolean>(false);
console.log(tooltipOpened);
const [isOpen, setIsOpen] = useState<boolean>(true);
useEffect(() => {
if (localStorage.getItem('tooltipIsOpen') === 'false') setIsOpen(false);
Copy link
Member

Choose a reason for hiding this comment

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

전역 상태가 아닌 로컬 스토리지를 사용하신 이유가 있을까요 ?!

}, []);

return (
<section className="flex flex-col items-center">
<div className="flex items-center">
<h3 className="text-main-violet">뽑은 제시어</h3>
<a
data-tooltip-id="my-tooltip"
data-tooltip-content={`제시어에 맞춰 포즈를 취해 보세요!\n독특한 나만의 포즈가 완성된답니다.`}
data-tooltip-place="top"
onMouseEnter={() => setTooltipOpened(true)}
style={{ cursor: 'pointer' }}
onClick={() => {
if (isOpen) {
localStorage.setItem('tooltipIsOpen', 'false');
setIsOpen(false);
} else {
localStorage.setItem('tooltipIsOpen', 'true');
setIsOpen(true);
}
}}
>
<Image src="/icons/info.svg" width={24} height={24} alt="info" />
</a>
</div>
<Tooltip id="my-tooltip" style={{ fontSize: '1rem', fontWeight: 400 }} />
<Tooltip
id="my-tooltip"
style={{ fontSize: '1rem', fontWeight: 400 }}
closeOnEsc
openOnClick
isOpen={isOpen}
render={() => (
<div
className="flex cursor-pointer"
onClick={() => {
localStorage.setItem('tooltipIsOpen', 'false');
setIsOpen(false);
}}
>
<div>
<p>제시어에 맞춰 포즈를 취해 보세요!</p>
<p>독특한 나만의 포즈가 완성된답니다.</p>
</div>
<Spacing size={8} direction="horizontal" />
<Image
src="/icons/close_white.svg"
width={20}
height={20}
alt="close"
className="mb-auto"
/>
</div>
)}
clickable
/>
<Spacing size={8} />
</section>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/(Main)/talk/page.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 Talk() {
return (
<div>
<Spacing size={30} />
<Spacing size={64} />
<TitleSection />
<TalkSection />
</div>
Expand Down
17 changes: 17 additions & 0 deletions src/app/(Sub)/bookmark/components/BookmarkHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Image from 'next/image';

import { Header } from '@/components/Header';
import { Spacing } from '@/components/Spacing';

export default function BookmarkHeader() {
const LeftNode = (
<div className="flex">
<Image src="/icons/arrow_back.svg" width={24} height={24} alt="back" />
<Spacing size={12} direction="horizontal" />
<h4>북마크</h4>
</div>
);
const RightNode = <Image src="/icons/menu.svg" width={24} height={24} alt="back" />;

return <Header leftNode={LeftNode} rightNode={RightNode} />;
}
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
<html lang="ko">
<body className="flex min-h-[100vh] w-screen touch-none justify-center bg-slate-100 py-px">
<RecoilContextProvider>
<div className="w-full max-w-440 bg-white text-primary drop-shadow-2xl">
<div className="w-full max-w-440 bg-white text-primary">
Copy link
Member

Choose a reason for hiding this comment

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

shadow가 있는게 입체적인 느낌(?) 도 들고 좋은데.... 문제가 된 drop-shadow 말고 그림자 효과 줄 수 있으면 좋을 것 같네요 ㅠ_ㅠ

별개로 이슈 말씀만 드렸는데 생각지도 못한 부분이 원인이라는걸 발견해주신 규성님 통찰력... 짱....! 👍🏻🙌

<QueryProvider>
<OverlayProvider>{children}</OverlayProvider>
</QueryProvider>
Expand Down
7 changes: 6 additions & 1 deletion src/components/Button/BottomFixedButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import Button, { type ButtonProps } from './Button';
import BottomFixedDiv from '../BottomFixedDiv';

export default function BottomFixedButton({ children, ...props }: ButtonProps) {
import type { StrictPropsWithChildren } from '@/types';

export default function BottomFixedButton({
children,
...props
}: StrictPropsWithChildren<ButtonProps>) {
return (
<BottomFixedDiv>
<Button {...props}>{children}</Button>
Expand Down
13 changes: 8 additions & 5 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { StrictPropsWithChildren } from '@/types';
'use client';
import { type HTMLMotionProps, motion } from 'framer-motion';

import type { ButtonHTMLAttributes } from 'react';
import type { StrictPropsWithChildren } from '@/types';

export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
export interface ButtonProps extends HTMLMotionProps<'button'> {
className?: string;
type?: 'button' | 'submit';
}
Expand All @@ -14,12 +15,14 @@ export default function Button({
...props
}: StrictPropsWithChildren<ButtonProps>) {
return (
<button
<motion.button
Copy link
Member

Choose a reason for hiding this comment

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

motion.button 은 처음 보는 것 같은데 .. 배워갑니다아..!

whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.9 }}
className={`flex h-60 w-full items-center justify-center rounded-xl py-14 text-center text-16 ${className}`}
type={type}
{...props}
>
<h5>{children}</h5>
</button>
</motion.button>
);
}
2 changes: 1 addition & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function Header({
...props
}: HeaderProps) {
return (
<div className="fixed inset-x-0 top-0 z-10 bg-white pt-8">
<div className="fixed inset-x-0 top-0 z-10 mx-auto max-w-440 bg-white pt-8">
Copy link
Member

Choose a reason for hiding this comment

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

fixed inset-x-0 인데 max-w 를 넣은 이유가 있을까요 ?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed는 브라우저 전체 사이즈를 기준으로 위치를 잡기에 너비 지정이 필요합니다. 440px보다 작은 디바이스에서는 사이즈가 줄어들 수 있게 max-w로 지정해주었습니다 !

<header
className={`flex h-48 items-center justify-between ${className ? className : ''}`}
{...props}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Modal/PortalWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';
import clsx from 'clsx';
import { useRef } from 'react';
import { twMerge } from 'tailwind-merge';

import { AnimatedPortal } from '../Portal';
import { useOnClickOutside } from '@/hooks/useOnClickOutside';
Expand Down Expand Up @@ -30,7 +29,7 @@ export default function PortalWrapper({
>
<div
className={clsx(
'fixed left-1/2 top-0 z-10 h-full w-full max-w-440 -translate-x-1/2',
'fixed left-1/2 top-0 z-10 flex h-full w-full max-w-440 -translate-x-1/2 items-center justify-center',
{
'bg-neutral-900 bg-opacity-90': isBackGroundBlur,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Spacing/Spacing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default memo(function Spacing({
}: SpacingProps) {
return (
<div
className={`flex-none bg-white ${className}`}
className={`flex-none ${className}`}
style={{
[direction === 'vertical' ? 'height' : 'width']: size + 'px',
}}
Expand Down
29 changes: 16 additions & 13 deletions src/hooks/useLoading.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
import { useCallback, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';

import useIsMounted from './useIsMounted';

interface UseLoadingProps {
initialState?: boolean;
loadingDelay?: number;
onStopLoading?: () => void;
isFirstLoadingInfinite?: boolean;
}
export default function useLoading({
initialState = true,
loadingDelay,
onStopLoading,
isFirstLoadingInfinite = false,
}: UseLoadingProps = {}) {
const [isLoading, setIsLoading] = useState(initialState ?? false);
const [isLoading, setIsLoading] = useState(initialState);
const isMounted = useIsMounted();

const stopLoading = useCallback(() => {
setIsLoading(false);
}, []);
if (onStopLoading) {
onStopLoading();
}
}, [onStopLoading]);

const startLoading = useCallback(() => {
setIsLoading(true);
setTimeout(() => {
stopLoading();
}, loadingDelay);
if (loadingDelay) {
setTimeout(stopLoading, loadingDelay);
}
}, [loadingDelay, stopLoading]);

if (isMounted) {
if (loadingDelay) {
setTimeout(() => {
stopLoading();
onStopLoading && onStopLoading();
}, loadingDelay);
useEffect(() => {
if (isMounted && !isFirstLoadingInfinite && loadingDelay) {
const timer = setTimeout(stopLoading, loadingDelay);
return () => clearTimeout(timer);
}
}
}, [isMounted, isFirstLoadingInfinite, loadingDelay, stopLoading]);

return { isLoading, stopLoading, startLoading };
}