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

refactor: 디자인 2차 수정 #165

Open
wants to merge 10 commits into
base: feat/v2
Choose a base branch
from
1 change: 1 addition & 0 deletions src/components/Product/ProductItem/productItem.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const productImage = style({
width: '100%',
height: 'auto',
minWidth: 163,
borderRadius: 6,
objectFit: 'cover',
aspectRatio: '1 / 1',
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link } from 'react-router-dom';

import { container, moreItem, notFound, recipeLink } from './productRecipeList.css';
import { container, moreItem, notFound, recipeLink, wrapper } from './productRecipeList.css';

import SearchNotFoundImage from '@/assets/search-notfound.png';
import { Text, ShowAllButton } from '@/components/Common';
Expand Down Expand Up @@ -41,7 +41,7 @@ const ProductRecipeList = ({ productId, productName }: ProductRecipeListProps) =
return (
<ul className={container}>
{recipeToDisplay.map((recipe) => (
<li key={recipe.id}>
<li key={recipe.id} className={wrapper}>
<DefaultRecipeItem recipe={recipe} />
</li>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export const container = style({
overflowX: 'auto',
});

export const wrapper = style({
height: '100%',
display: 'flex',
flex: '0 0 160px',
Copy link
Contributor

Choose a reason for hiding this comment

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

CSS 고수시네요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

프론트엔드 시니어와 함께 한 CSS랄까요~~

Copy link
Contributor

Choose a reason for hiding this comment

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

시니어 여전히 믿음직 하네요 👍

});

export const moreItem = style({
display: 'flex',
justifyContent: 'center',
Expand Down
26 changes: 16 additions & 10 deletions src/components/Recipe/CommentForm/CommentForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useToastActionContext } from '@fun-eat/design-system';
import type { ChangeEventHandler, FormEventHandler, RefObject } from 'react';
import { useRef, useState } from 'react';
import { useRef, useState, useEffect } from 'react';

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

import { SvgIcon, Text } from '@/components/Common';
import { MemberImage } from '@/components/Members';
Expand Down Expand Up @@ -65,26 +65,32 @@ const CommentForm = ({ recipeId, scrollTargetRef }: CommentFormProps) => {
);
};

useEffect(() => {
autoResizeTextarea();
}, [commentValue]);

return (
<div className={container}>
<MemberImage src={member?.profileImage || ''} width={29} height={29} />
<MemberImage src={member?.profileImage || ''} width={33} height={33} />
<>
<form className={commentForm} onSubmit={handleSubmitComment}>
<textarea
className={commentTextarea}
placeholder="댓글을 남겨보세요! (200자)"
placeholder="댓글을 남겨보세요!"
value={commentValue}
onChange={handleCommentInput}
maxLength={MAX_COMMENT_LENGTH}
rows={1}
ref={textAreaRef}
/>
<Text size="caption4" color="disabled">
{commentValue.length}/200
</Text>
<button className={commentValue.length === 0 ? sendButton['disabled'] : sendButton['active']}>
<SvgIcon variant="plane" width={14} height={14} fill={vars.colors.white} />
</button>
<div className={buttonWrapper}>
<Text size="caption4" color="disabled">
{commentValue.length}/200
</Text>
<button className={commentValue.length === 0 ? sendButton['disabled'] : sendButton['active']}>
<SvgIcon variant="plane" width={14} height={14} fill={vars.colors.white} />
</button>
</div>
</form>
</>
</div>
Expand Down
14 changes: 10 additions & 4 deletions src/components/Recipe/CommentForm/commentForm.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ import { style, styleVariants } from '@vanilla-extract/css';

export const container = style({
display: 'flex',
gap: 8,
alignItems: 'flex-end',
marginBottom: 24,
gap: 8,
});

export const commentForm = style({
display: 'flex',
gap: 8,
alignItems: 'flex-end',
width: '100%',
padding: '6px 16px 9px 16px',
padding: '6px 16px',
gap: 8,
background: vars.colors.background.category,
borderRadius: 20,
});

export const commentTextarea = style({
width: '100%',
height: '100%',
padding: '6px 0',
border: 'none',
outline: 'none',
background: 'none',
Expand All @@ -34,8 +35,13 @@ export const commentTextarea = style({
},
});

export const buttonWrapper = style({
display: 'flex',
alignItems: 'center',
gap: 6,
});

export const sendButtonStyles = style({
display: 'inherit',
width: 36,
borderRadius: 45,
padding: '4px 10px',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRef } from 'react';

import { listWrapper } from './recipeSearchResultPreviewList.css';
import { container, wrapper } from './recipeSearchResultPreviewList.css';
import SearchNotFound from '../SearchNotFound/SearchNotFound';

import { ShowAllButton } from '@/components/Common';
Expand All @@ -26,9 +26,9 @@ const RecipeSearchResultPreviewList = ({ searchQuery }: RecipeSearchResultPrevie
}

return (
<ul className={listWrapper}>
<ul className={container}>
{displaySlice(false, recipes, 4).map((recipe, idx) => (
<li key={recipe.id}>
<li key={recipe.id} className={wrapper}>
{idx < 4 ? (
<DefaultRecipeItem recipe={recipe} />
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { style } from '@vanilla-extract/css';

export const listWrapper = style({
export const container = style({
display: 'flex',
gap: 10,
alignItems: 'center',
overflowY: 'scroll',
});

export const wrapper = style({
height: '100%',
display: 'flex',
flex: '0 0 160px',
});
Loading