Skip to content

Commit

Permalink
Merge pull request #32 from epigram5-9/epic/FE-46-common-components
Browse files Browse the repository at this point in the history
FE-46 ๐Ÿ”จ ๊ณต์šฉ ์ปดํฌ๋„ŒํŠธ ๋ฉ˜ํ† ๋ง ์ˆ˜์ •์‚ฌํ•ญ ๋ฐ˜์˜
  • Loading branch information
newjinlee authored Jul 20, 2024
2 parents 550de0e + 8dd99fa commit cdf96d7
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 58 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module.exports = {
'react/jsx-props-no-spreading': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['off'],
"react/require-default-props": 'off',
"react/self-closing-comp": 'off',
},
settings: {
react: {
Expand Down
16 changes: 13 additions & 3 deletions src/components/Card/CommentCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React from 'react';
import Image from 'next/image';
import { CommentCardProps } from '@/types/CommentCardTypes';
import { sizeStyles, textSizeStyles, gapStyles, paddingStyles, contentWidthStyles } from '@/styles/CommentCardStyles';

export interface CommentCardProps {
status: 'edit' | 'complete';
}

function CommentCard({ status }: CommentCardProps) {
return (
<div
Expand All @@ -17,8 +20,14 @@ function CommentCard({ status }: CommentCardProps) {
<div className={`flex-col justify-start items-start ${gapStyles.sm} ${gapStyles.md} ${gapStyles.lg} inline-flex ${contentWidthStyles.sm} ${contentWidthStyles.md} ${contentWidthStyles.lg}`}>
<div className='justify-between items-center w-full inline-flex'>
<div className='justify-start items-start gap-2 flex'>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.name} ${textSizeStyles.md.name} ${textSizeStyles.lg.name}`}>์ง€ํ‚ฌ๊ณผ ํ•˜์ด๋“œ</div>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.time} ${textSizeStyles.md.time} ${textSizeStyles.lg.time}`}>1์‹œ๊ฐ„ ์ „</div>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.name} ${textSizeStyles.md.name} ${textSizeStyles.lg.name}`}>
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}
์ง€ํ‚ฌ๊ณผ ํ•˜์ด๋“œ
</div>
<div className={`text-zinc-600 font-normal font-pretendard leading-normal ${textSizeStyles.sm.time} ${textSizeStyles.md.time} ${textSizeStyles.lg.time}`}>
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}
1์‹œ๊ฐ„ ์ „
</div>
</div>
{status === 'edit' && (
<div className='justify-start items-start gap-4 flex'>
Expand All @@ -30,6 +39,7 @@ function CommentCard({ status }: CommentCardProps) {
<div
className={`w-full text-zinc-800 font-normal font-pretendard ${textSizeStyles.sm.content} ${textSizeStyles.md.content} ${textSizeStyles.lg.content} ${contentWidthStyles.sm} ${contentWidthStyles.md} ${contentWidthStyles.lg}`}
>
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}
์˜ค๋Š˜ ํ•˜๋ฃจ ์šฐ์šธํ–ˆ์—ˆ๋Š”๋ฐ ๋•๋ถ„์— ๋งŽ์€ ํž˜ ์–ป๊ณ  ๊ฐ‘๋‹ˆ๋‹ค. ์—ฐ๊ธˆ์ˆ ์‚ฌ ์ฑ… ๋‹ค์‹œ ์‚ฌ์„œ ์˜ค๋žœ๋งŒ์— ์ฝ์–ด๋ด์•ผ๊ฒ ์–ด์š”!
</div>
</div>
Expand Down
21 changes: 12 additions & 9 deletions src/components/Card/EpigramCard.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';

// figma ์ƒ์œผ๋กœ๋Š” sm ~ 3xl ์‚ฌ์ด์ฆˆ๋กœ ๊ตฌํ˜„๋˜์–ด ์žˆ๋Š”๋ฐ, tailwind ํ™˜๊ฒฝ์„ ๋ฐ˜์˜ํ•ด
// base ~ 2xl ์œผ๋กœ ์ •์˜ํ–ˆ์Šต๋‹ˆ๋‹ค.
// xs ~ 2xl ์œผ๋กœ ์ •์˜ํ–ˆ์Šต๋‹ˆ๋‹ค.
const sizeStyles = {
base: 'w-[286px] max-h-[132px]',
xs: 'w-[286px] max-h-[132px]',
sm: 'sm:w-[312px] sm:max-h-[152px]',
md: 'md:w-[384px] md:max-h-[180px]',
lg: 'lg:w-[540px] lg:max-h-[160px]',
Expand All @@ -12,7 +12,7 @@ const sizeStyles = {
};

const textSizeStyles = {
base: 'text-xs',
xs: 'text-xs',
sm: 'sm:text-sm',
md: 'md:text-base',
lg: 'lg:text-xl',
Expand All @@ -22,34 +22,37 @@ const textSizeStyles = {

function EpigramCard() {
return (
<div className={`relative flex-col justify-start items-end gap-2 inline-flex ${sizeStyles.base} ${sizeStyles.sm} ${sizeStyles.md} ${sizeStyles.lg} ${sizeStyles.xl} ${sizeStyles['2xl']}`}>
<div className={`relative flex-col justify-start items-end gap-2 inline-flex ${sizeStyles.xs} ${sizeStyles.sm} ${sizeStyles.md} ${sizeStyles.lg} ${sizeStyles.xl} ${sizeStyles['2xl']}`}>
<div className='w-full p-[22px] bg-white rounded-[14.67px] shadow border border-zinc-100 flex-col justify-start items-start flex relative overflow-hidden'>
{/* eslint-disable-next-line */}
<div className='absolute inset-0 bg-stripes w-full h-full'></div> {/* ์ค„๋ฌด๋Šฌ๋ฅผ ๋งŒ๋“ค๋ ค๋ฉด ๋น„์–ด์žˆ๋Š” div๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. */}
<div className='relative w-full z-10 flex flex-col justify-start items-start flex-1'>
<div className='self-stretch flex-col justify-start items-start gap-2 flex'>
<div
className={`self-stretch ${textSizeStyles.base} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-neutral-700 font-normal font-iropkeBatang leading-normal`}
className={`self-stretch ${textSizeStyles.xs} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-neutral-700 font-normal font-iropkeBatang leading-normal`}
>
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}
์˜ค๋žซ๋™์•ˆ ๊ฟˆ์„ ๊ทธ๋ฆฌ๋Š” ์‚ฌ๋žŒ์€ ๋งˆ์นจ๋‚ด ๊ทธ ๊ฟˆ์„ ๋‹ฎ์•„ ๊ฐ„๋‹ค.
</div>
<div
className={`self-stretch ${textSizeStyles.base} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-right text-slate-400 font-normal font-iropkeBatang leading-normal`}
className={`self-stretch ${textSizeStyles.xs} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-right text-slate-400 font-normal font-iropkeBatang leading-normal`}
>
- ์•™๋“œ๋ ˆ ๋ง๋กœ -
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}- ์•™๋“œ๋ ˆ ๋ง๋กœ -
</div>
</div>
</div>
</div>
<div className='justify-start items-start gap-2 inline-flex'>
<div
className={`text-right ${textSizeStyles.base} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-slate-400 font-normal font-iropkeBatang leading-normal`}
className={`text-right ${textSizeStyles.xs} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-slate-400 font-normal font-iropkeBatang leading-normal`}
>
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}
#๋‚˜์•„๊ฐ€์•ผํ• ๋•Œ
</div>
<div
className={`text-right ${textSizeStyles.base} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-slate-400 font-normal font-iropkeBatang leading-normal`}
className={`text-right ${textSizeStyles.xs} ${textSizeStyles.sm} ${textSizeStyles.md} ${textSizeStyles.lg} ${textSizeStyles.xl} ${textSizeStyles['2xl']} text-slate-400 font-normal font-iropkeBatang leading-normal`}
>
{/* ํ…Œ์ŠคํŠธ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค. */}
#๊ฟˆ์„์ด๋ฃจ๊ณ ์‹ถ์„๋•Œ
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
1๊ฐœ์˜ ๊ฐ์ • ์•„์ด์ฝ˜ ์นด๋“œ๋ฅผ ๋žœ๋”๋ง ํ•ฉ๋‹ˆ๋‹ค.
์•„์ด์ฝ˜์˜ ํƒ€์ž…, ์ƒํƒœ, ํฌ๊ธฐ, ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
์•„์ด์ฝ˜ ํƒ€์ž…๊ณผ ์ƒํƒœ์— ๋”ฐ๋ผ ์•„์ด์ฝ˜์˜ ๋ชจ์–‘๊ณผ ์Šคํƒ€์ผ์„ ์กฐ์ •ํ•ฉ๋‹ˆ๋‹ค.
*/

import React from 'react';
import cn from '@/lib/utils';
import Image from 'next/image';
Expand Down Expand Up @@ -104,11 +110,4 @@ function EmotionIconCard({ iconType = '๊ฐ๋™', state = 'Default', size = 'sm',
);
}

EmotionIconCard.displayName = 'EmotionIconCard';

// ๊ธฐ๋ณธ props ์„ค์ •
EmotionIconCard.defaultProps = {
onClick: () => {},
};

export default EmotionIconCard;
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/*
์—ฌ๋Ÿฌ ๊ฐœ์˜ EmotionIconCard๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค์— ํ•„์š”ํ•œ ์ƒํ˜ธ ์ž‘์šฉ ๋กœ์ง์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.
*/

import React, { useState } from 'react';
import InteractiveEmotionIconCard from '@/components/Emotion/card/InteractiveEmotionIconCard';
import EmotionIconCard from '@/components/Emotion/EmotionCard';
import useMediaQuery from '@/hooks/useMediaQuery';
import { EmotionType, EmotionState } from '@/types/EmotionTypes';

Expand Down Expand Up @@ -52,7 +57,7 @@ function EmotionSelector() {
return (
<div className={`justify-start items-start inline-flex ${containerClass}`}>
{(['๊ฐ๋™', '๊ธฐ์จ', '๊ณ ๋ฏผ', '์Šฌํ””', '๋ถ„๋…ธ'] as const).map((iconType) => (
<InteractiveEmotionIconCard key={iconType} iconType={iconType} size={cardSize} state={states[iconType]} onClick={() => handleCardClick(iconType)} />
<EmotionIconCard key={iconType} iconType={iconType} size={cardSize} state={states[iconType]} onClick={() => handleCardClick(iconType)} />
))}
</div>
);
Expand Down
12 changes: 0 additions & 12 deletions src/components/Emotion/card/InteractiveEmotionIconCard.tsx

This file was deleted.

32 changes: 22 additions & 10 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
import React from 'react';
import { useRouter } from 'next/router';
import Image from 'next/image';
import { HeaderProps } from '../../types/Header';
import { useToast } from '../ui/use-toast';
import LOGO_ICON from '../../../public/epigram-icon.png';
import ARROW_LEFT_ICON from '../../../public/icon/arrow-left-icon.svg';
import PROFILE_ICON from '../../../public/icon/profile-icon.svg';
import SEARCH_ICON from '../../../public/icon/search-icon.svg';
import SHARE_ICON from '../../../public/icon/share-icon.svg';

// TODO ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ”๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ปดํฌ๋„ŒํŠธ ์ž…๋‹ˆ๋‹ค.
// TODO ์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ์—์„œ Props๋ฅผ ๋ฐ›์•„ ์›ํ•˜๋Š” ์Šคํƒ€์ผ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
// TODO ์‚ฌ์šฉ ์˜ˆ์‹œ
// TODO <Header icon='back' routerPage='์›ํ•˜๋Š” ํŽ˜์ด์ง€ ์ฃผ์†Œ' isLogo={false} insteadOfLogo='์„ผํ„ฐ ํ…์ŠคํŠธ' isProfileIcon={false} isShareIcon={false} isButton textInButton='๋ฒ„ํŠผ ํ…์ŠคํŠธ' disabled={false} onClick={๋™์ž‘ํ•  ํ•จ์ˆ˜} />
// TODO <Header icon='search' routerPage='/search' isLogo insteadOfLogo='' isProfileIcon isShareIcon={false} isButton={false} textInButton='' disabled={false} onClick={() => {}} />;
// TODO icon: 'back'์„ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ routerPage์˜ ๊ฐ’์„ ๋ฌด์กฐ๊ฑด ์ง€์ •ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
// TODO isLogo={false}์ผ ๊ฒฝ์šฐ insteadOfLogo์˜ ๊ฐ’์„ ๋ฌด์กฐ๊ฑด ์ง€์ •ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
// TODO isButton ์ผ ๊ฒฝ์šฐ textInButton์˜ ๊ฐ’์„ ๋ฌด์กฐ๊ฑด ์ง€์ •ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
// TODO SHARE_ICON ์ถ”๊ฐ€ ์‹œ ํ† ์ŠคํŠธ ๊ธฐ๋Šฅ๋„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ ์•„๋ž˜ <Toaster /> ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.
// NOTE ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ”๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ปดํฌ๋„ŒํŠธ ์ž…๋‹ˆ๋‹ค.
// NOTE ์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ์—์„œ Props๋ฅผ ๋ฐ›์•„ ์›ํ•˜๋Š” ์Šคํƒ€์ผ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
// NOTE ์‚ฌ์šฉ ์˜ˆ์‹œ
// NOTE <Header icon='back' routerPage='์›ํ•˜๋Š” ํŽ˜์ด์ง€ ์ฃผ์†Œ' isLogo={false} insteadOfLogo='์„ผํ„ฐ ํ…์ŠคํŠธ' isProfileIcon={false} isShareIcon={false} isButton textInButton='๋ฒ„ํŠผ ํ…์ŠคํŠธ' disabled={false} onClick={๋™์ž‘ํ•  ํ•จ์ˆ˜} />
// NOTE <Header icon='search' routerPage='/search' isLogo insteadOfLogo='' isProfileIcon isShareIcon={false} isButton={false} textInButton='' disabled={false} onClick={() => {}} />;
// NOTE icon: 'back'์„ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ routerPage์˜ ๊ฐ’์„ ๋ฌด์กฐ๊ฑด ์ง€์ •ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
// NOTE isLogo={false}์ผ ๊ฒฝ์šฐ insteadOfLogo์˜ ๊ฐ’์„ ๋ฌด์กฐ๊ฑด ์ง€์ •ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
// NOTE isButton ์ผ ๊ฒฝ์šฐ textInButton์˜ ๊ฐ’์„ ๋ฌด์กฐ๊ฑด ์ง€์ •ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
// NOTE SHARE_ICON ์ถ”๊ฐ€ ์‹œ ํ† ์ŠคํŠธ ๊ธฐ๋Šฅ๋„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ ์•„๋ž˜ <Toaster /> ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.

export interface HeaderProps {
icon: 'back' | 'search' | '';
routerPage: string;
isLogo: boolean;
insteadOfLogo: string;
isProfileIcon: boolean;
isShareIcon: boolean;
isButton: boolean;
textInButton: string;
disabled: boolean;
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
}

function Header({ isLogo, icon, insteadOfLogo, isButton, isProfileIcon, isShareIcon, textInButton, routerPage, disabled, onClick }: HeaderProps) {
const router = useRouter();
Expand Down
3 changes: 0 additions & 3 deletions src/types/CommentCardTypes.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/types/Header.ts

This file was deleted.

0 comments on commit cdf96d7

Please sign in to comment.