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

[FE] feat: 랭킹 기준 텍스트 추가 #765

Merged
merged 4 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions frontend/src/components/Common/Svg/SvgIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const SVG_ICON_VARIANTS = [
'pencil',
'camera',
'plane',
'info'
] as const;
export type SvgIconVariant = (typeof SVG_ICON_VARIANTS)[number];

Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/Common/Svg/SvgSprite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ const SvgSprite = () => {
<symbol id="plane" viewBox="0 0 256 256">
<path d="M232 127.89a16 16 0 0 1-8.18 14L55.91 237.9A16.14 16.14 0 0 1 48 240a16 16 0 0 1-15.05-21.34l27.35-79.95a4 4 0 0 1 3.79-2.71H136a8 8 0 0 0 8-8.53a8.19 8.19 0 0 0-8.26-7.47H64.16a4 4 0 0 1-3.79-2.7l-27.44-80a16 16 0 0 1 22.92-19.23l168 95.89a16 16 0 0 1 8.15 13.93Z" />
</symbol>
<symbol id="info" viewBox="0 0 16 16">
<path d="M8 7a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0v-3A.5.5 0 0 1 8 7zm0-.75a.749.749 0 1 0 0-1.5.749.749 0 0 0 0 1.498zM2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8zm6-5a5 5 0 1 0 0 10A5 5 0 0 0 8 3z" />
</symbol>
</svg>
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

storybook preview-body.html에도 추가해주세요~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ProductDetailItem = ({ category, productDetail }: ProductDetailItemProps)
<Text weight="bold">평균 평점</Text>
<RatingIconWrapper>
<SvgIcon variant="star" width={20} height={20} color={theme.colors.secondary} />
<Text as="span">{averageRating}</Text>
<Text as="span">{averageRating.toFixed(1)}</Text>
</RatingIconWrapper>
</DescriptionWrapper>
</DetailInfoWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ProductItem = ({ product }: ProductItemProps) => {
<RatingIconWrapper>
<SvgIcon variant="star" width={20} height={20} color={theme.colors.secondary} />
<Text as="span" size="sm" css="line-height: 24px;" aria-label={`${averageRating}점`}>
{averageRating}
{averageRating.toFixed(1)}
</Text>
</RatingIconWrapper>
<ReviewIconWrapper>
Expand Down
46 changes: 40 additions & 6 deletions frontend/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { Heading, Spacing } from '@fun-eat/design-system';
import { Heading, Spacing, Text, useTheme } from '@fun-eat/design-system';
import { useQueryErrorResetBoundary } from '@tanstack/react-query';
import { Suspense } from 'react';
import styled from 'styled-components';

import { Loading, ErrorBoundary, ErrorComponent, CategoryFoodList, CategoryStoreList } from '@/components/Common';
import {
Loading,
ErrorBoundary,
ErrorComponent,
CategoryFoodList,
CategoryStoreList,
SvgIcon,
} from '@/components/Common';
import { ProductRankingList, ReviewRankingList, RecipeRankingList } from '@/components/Rank';
import { IMAGE_URL } from '@/constants';
import channelTalk from '@/service/channelTalk';

export const HomePage = () => {
const { reset } = useQueryErrorResetBoundary();
const theme = useTheme();

channelTalk.loadScript();

Expand Down Expand Up @@ -41,7 +49,12 @@ export const HomePage = () => {
<Heading as="h2" size="xl">
🍯 꿀조합 랭킹
</Heading>
<Spacing size={16} />
<RankingInfoWrapper>
<SvgIcon variant="info" width={18} height={18} color={theme.textColors.info} />
<Text size="sm" color={theme.textColors.info}>
꿀조합 랭킹은 자체 알고리즘 기반으로 업데이트됩니다.
</Text>
</RankingInfoWrapper>
<ErrorBoundary fallback={ErrorComponent} handleReset={reset}>
<Suspense fallback={<Loading />}>
<RecipeRankingList />
Expand All @@ -51,9 +64,14 @@ export const HomePage = () => {
<Spacing size={36} />
<SectionWrapper>
<Heading as="h2" size="xl">
👑 상품 랭킹
🍙 상품 랭킹
</Heading>
<Spacing size={15} />
<RankingInfoWrapper>
<SvgIcon variant="info" width={18} height={18} color={theme.textColors.info} />
<Text size="sm" color={theme.textColors.info}>
상품 랭킹은 2주 단위로 업데이트됩니다.
</Text>
</RankingInfoWrapper>
<ErrorBoundary fallback={ErrorComponent} handleReset={reset}>
<Suspense fallback={<Loading />}>
<ProductRankingList isHomePage />
Expand All @@ -65,7 +83,12 @@ export const HomePage = () => {
<Heading as="h2" size="xl">
📝 리뷰 랭킹
</Heading>
<Spacing size={15} />
<RankingInfoWrapper>
<SvgIcon variant="info" width={18} height={18} color={theme.textColors.info} />
<Text size="sm" color={theme.textColors.info}>
리뷰 랭킹은 자체 알고리즘 기반으로 업데이트됩니다.
</Text>
</RankingInfoWrapper>
<ErrorBoundary fallback={ErrorComponent} handleReset={reset}>
<Suspense fallback={<Loading />}>
<ReviewRankingList isHomePage />
Expand Down Expand Up @@ -100,3 +123,14 @@ const CategoryListWrapper = styled.div`
display: none;
}
`;

const RankingInfoWrapper = styled.div`
display: flex;
align-items: center;
gap: 2px;
margin: 8px 0 16px;

& > svg {
padding-bottom: 2px;
}
`;
Loading