Skip to content

Commit

Permalink
Merge branch 'feat/v2' into feat/issue-88
Browse files Browse the repository at this point in the history
  • Loading branch information
Leejin-Yang committed Apr 19, 2024
2 parents bb22d72 + 12e792f commit 9a49c0a
Show file tree
Hide file tree
Showing 24 changed files with 387 additions and 200 deletions.
3 changes: 1 addition & 2 deletions src/components/Members/MemberRecipeList/MemberRecipeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useRef } from 'react';
import { Link as RouterLink } from 'react-router-dom';
import styled from 'styled-components';

import { RecipeItem } from '@/components/Recipe';
import { PATH } from '@/constants/path';
import { useIntersectionObserver } from '@/hooks/common';
import { useInfiniteMemberRecipeQuery } from '@/hooks/queries/members';
Expand Down Expand Up @@ -50,7 +49,7 @@ const MemberRecipeList = ({ isPreview = false }: MemberRecipeListProps) => {
{recipeToDisplay?.map((recipe) => (
<li key={recipe.id}>
<Link as={RouterLink} to={`${PATH.RECIPE}/${recipe.id}`}>
<RecipeItem recipe={recipe} isMemberPage={isPreview} />
{/* <RecipeItem recipe={recipe} isMemberPage={isPreview} /> */}
</Link>
</li>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

import SearchNotFoundImage from '@/assets/search-notfound.png';
import { SvgIcon, Text } from '@/components/Common';
import { RecipeItem } from '@/components/Recipe';
import { DefaultRecipeItem } from '@/components/Recipe';
import { PATH } from '@/constants/path';
import { useInfiniteProductRecipesQuery } from '@/hooks/queries/product';
import { vars } from '@/styles/theme.css';
Expand Down Expand Up @@ -50,7 +50,7 @@ const ProductRecipeList = ({ productId }: ProductRecipeListProps) => {
<ul className={container}>
{recipeToDisplay.map((recipe) => (
<li key={recipe.id}>
<RecipeItem recipe={recipe} hasFavoriteButton />
<DefaultRecipeItem recipe={recipe} />
</li>
))}
{recipeToDisplay.length < recipes.length && (
Expand Down

This file was deleted.

33 changes: 0 additions & 33 deletions src/components/Rank/RecipeRankingItem/RecipeRankingItem.tsx

This file was deleted.

31 changes: 0 additions & 31 deletions src/components/Rank/RecipeRankingItem/recipeRankingItem.css.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Rank/RecipeRankingList/RecipeRankingList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Link } from 'react-router-dom';

import { container } from './recipeRankingList.css';
import RecipeRankingItem from '../RecipeRankingItem/RecipeRankingItem';

import { DefaultRecipeItem } from '@/components/Recipe';
import { PATH } from '@/constants/path';
import { useGA } from '@/hooks/common';
import { useRecipeRankingQuery } from '@/hooks/queries/rank';
Expand All @@ -22,7 +22,7 @@ const RecipeRankingList = () => {
{recipeResponse.recipes.map((recipe) => (
<li key={recipe.id}>
<Link to={`${PATH.RECIPE}/${recipe.id}`} onClick={handleRecipeRankingLinkClick}>
<RecipeRankingItem recipe={recipe} />
<DefaultRecipeItem recipe={recipe} />
</Link>
</li>
))}
Expand Down
1 change: 0 additions & 1 deletion src/components/Rank/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ export { default as ReviewRankingItem } from './ReviewRankingItem/ReviewRankingI
export { default as ReviewRankingList } from './ReviewRankingList/ReviewRankingList';
export { default as ProductRankingItem } from './ProductRankingItem/ProductRankingItem';
export { default as ProductRankingList } from './ProductRankingList/ProductRankingList';
export { default as RecipeRankingItem } from './RecipeRankingItem/RecipeRankingItem';
export { default as RecipeRankingList } from './RecipeRankingList/RecipeRankingList';
20 changes: 5 additions & 15 deletions src/components/Recipe/CommentForm/CommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { useToastActionContext } from '@fun-eat/design-system';
import type { ChangeEventHandler, FormEventHandler, RefObject } from 'react';
import { useRef, useState } from 'react';

import { commentForm, commentTextarea, container, profileImage, sendButton } from './commentForm.css';
import { commentForm, commentTextarea, container, sendButton } from './commentForm.css';

import { SvgIcon, Text } from '@/components/Common';
import { MemberImage } from '@/components/Members';
import { useScroll } from '@/hooks/common';
import { useMemberQuery } from '@/hooks/queries/members';
import { useRecipeCommentMutation } from '@/hooks/queries/recipe';
Expand Down Expand Up @@ -66,13 +67,7 @@ const CommentForm = ({ recipeId, scrollTargetRef }: CommentFormProps) => {

return (
<div className={container}>
<img
className={profileImage}
src={member?.profileImage}
width={29}
height={29}
alt={`${member?.nickname}의 프로필 사진`}
/>
<MemberImage src={member?.profileImage || ''} width={29} height={29} alt={`${member?.nickname}의 프로필 사진`} />
<>
<form className={commentForm} onSubmit={handleSubmitComment}>
<textarea
Expand All @@ -87,13 +82,8 @@ const CommentForm = ({ recipeId, scrollTargetRef }: CommentFormProps) => {
<Text size="caption4" color="disabled">
{commentValue.length}/200
</Text>
<button className={sendButton}>
<SvgIcon
variant="plane"
width={18}
height={18}
fill={commentValue.length === 0 ? vars.colors.gray3 : vars.colors.gray5}
/>
<button className={commentValue.length === 0 ? sendButton['disabled'] : sendButton['active']}>
<SvgIcon variant="plane" width={14} height={14} fill={vars.colors.white} />
</button>
</form>
</>
Expand Down
14 changes: 9 additions & 5 deletions src/components/Recipe/CommentForm/commentForm.css.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { vars } from '@/styles/theme.css';
import { style } from '@vanilla-extract/css';
import { style, styleVariants } from '@vanilla-extract/css';

export const container = style({
display: 'flex',
Expand Down Expand Up @@ -34,10 +34,14 @@ export const commentTextarea = style({
},
});

export const profileImage = style({
borderRadius: '50%',
export const sendButtonStyles = style({
display: 'inherit',
width: 36,
borderRadius: 45,
padding: '4px 10px',
});

export const sendButton = style({
display: 'inherit',
export const sendButton = styleVariants({
active: [sendButtonStyles, { background: vars.colors.primary }],
disabled: [sendButtonStyles, { background: vars.colors.gray3 }],
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { style } from '@vanilla-extract/css';

export const container = style({
display: 'flex',
gap: 6,
alignItems: 'center',
gap: 6,
});
34 changes: 29 additions & 5 deletions src/components/Recipe/RecipeItem/RecipeItem.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
import type { Meta, StoryObj } from '@storybook/react';

import RecipeItem from './RecipeItem';
import RecipeItem, {
DefaultRecipeItem,
RecipeItemWithDiskIcon,
RecipeItemWithDiskIconAndContent,
RecipeItemWithProductDetailImage,
} from './RecipeItem';

import mockRecipe from '@/mocks/data/recipes.json';

const meta: Meta<typeof RecipeItem> = {
title: 'recipe/RecipeItem',
component: RecipeItem,
args: {
recipe: mockRecipe.recipes[0],
},
};

export default meta;
type Story = StoryObj<typeof RecipeItem>;

export const Default: Story = {};
export const Default: Story = {
render: () => {
return <DefaultRecipeItem recipe={mockRecipe.recipes[1]} />;
},
};

export const Recipe: Story = {
render: () => {
return <RecipeItemWithDiskIconAndContent recipe={mockRecipe.recipes[1]} />;
},
};

export const MyPage: Story = {
render: () => {
return <RecipeItemWithProductDetailImage recipe={mockRecipe.recipes[1]} />;
},
};

export const Search: Story = {
render: () => {
return <RecipeItemWithDiskIcon recipe={mockRecipe.recipes[1]} />;
},
};
Loading

0 comments on commit 9a49c0a

Please sign in to comment.