diff --git a/apps/jurumarble/src/app/drink-info/[id]/components/DrinkInfoContainer.tsx b/apps/jurumarble/src/app/drink-info/[id]/components/DrinkInfoContainer.tsx index 21a5808e..3dc1e1b3 100644 --- a/apps/jurumarble/src/app/drink-info/[id]/components/DrinkInfoContainer.tsx +++ b/apps/jurumarble/src/app/drink-info/[id]/components/DrinkInfoContainer.tsx @@ -1,7 +1,7 @@ import { useToggle } from '@monorepo/hooks'; import Chip from 'components/Chip'; import Loading from 'components/Loading'; -import ReplaceLoginPageModal from 'components/ReplaceLoginPagemModal/ReplaceLoginPageModal'; +import { ReplaceLoginPageModal } from 'components/ReplaceLoginPageModal'; import VoteHeader from 'components/VoteHeader'; import { Button } from 'components/button'; import Path from 'lib/Path'; diff --git a/apps/jurumarble/src/app/main/components/Carousel.tsx b/apps/jurumarble/src/app/main/components/Carousel.tsx index 535cb0e8..b9c9b3d6 100644 --- a/apps/jurumarble/src/app/main/components/Carousel.tsx +++ b/apps/jurumarble/src/app/main/components/Carousel.tsx @@ -54,7 +54,7 @@ function Carousel({ hotDrinkList }: Props) { > - {index + 1} + {index + 1} css` background-color: ${theme.colors.main_01}; diff --git a/apps/jurumarble/src/app/map/components/MapContainer.tsx b/apps/jurumarble/src/app/map/components/MapContainer.tsx index 790321fb..78700645 100644 --- a/apps/jurumarble/src/app/map/components/MapContainer.tsx +++ b/apps/jurumarble/src/app/map/components/MapContainer.tsx @@ -5,7 +5,7 @@ import { useEffect, useRef, useState } from 'react'; import { useToggle } from '@react-hookz/web'; import DrinkItem from 'app/stamp/components/DrinkItem'; import Loading from 'components/Loading'; -import ReplaceLoginPageModal from 'components/ReplaceLoginPagemModal/ReplaceLoginPageModal'; +import { ReplaceLoginPageModal } from 'components/ReplaceLoginPageModal'; import { Button } from 'components/button'; import Path from 'lib/Path'; import Image from 'next/image'; diff --git a/apps/jurumarble/src/app/my/components/VoteCountContainer.tsx b/apps/jurumarble/src/app/my/components/VoteCountContainer.tsx index 46baebde..e5a63af6 100644 --- a/apps/jurumarble/src/app/my/components/VoteCountContainer.tsx +++ b/apps/jurumarble/src/app/my/components/VoteCountContainer.tsx @@ -1,8 +1,8 @@ 'use client'; -import { TAB_LIST, TabList } from 'src/types/my'; import styled, { css } from 'styled-components'; +import { TAB_LIST, TabList } from '../constants'; import useGetTheNumberOfMyVoteService from '../services/useGetCountedVoteService'; interface Props { @@ -31,7 +31,7 @@ function VoteCountContainer({ selectedTab, onClickSelectedTab }: Props) { {id === 'created-vote' ? writtenVoteCnt - : id === 'paticipated-vote' + : id === 'participated-vote' ? joinedVoteCnt : id === 'bookmarked-vote' ? bookmarkedVoteCnt diff --git a/apps/jurumarble/src/app/my/components/VoteListContainer.tsx b/apps/jurumarble/src/app/my/components/VoteListContainer.tsx index d8683ca3..46e989f8 100644 --- a/apps/jurumarble/src/app/my/components/VoteListContainer.tsx +++ b/apps/jurumarble/src/app/my/components/VoteListContainer.tsx @@ -2,11 +2,11 @@ import { useCreateQueryString } from 'hooks/useCreateQueryString'; import { usePathname, useRouter, useSearchParams } from 'next/navigation'; -import { TabList } from 'src/types/my'; import styled, { css } from 'styled-components'; import VoteCountContainer from './VoteCountContainer'; import VoteItem from './VoteItem'; +import { TabList } from '../constants'; import useGetMyBookmarkedVoteListService from '../services/useGetMyBookmarkedVoteListService'; import useGetMyCreatedVoteListService from '../services/useGetMyCreatedVoteListService'; import useGetMyParticipatedVoteListService from '../services/useGetMyParticipatedVoteListService'; @@ -18,7 +18,7 @@ import useGetMyParticipatedVoteListService from '../services/useGetMyParticipate const MY_VOTE_LIST_SERVICE = { 'created-vote': useGetMyCreatedVoteListService, 'bookmarked-vote': useGetMyBookmarkedVoteListService, - 'paticipated-vote': useGetMyParticipatedVoteListService, + 'participated-vote': useGetMyParticipatedVoteListService, }; function VoteListContainer() { diff --git a/apps/jurumarble/src/types/my.ts b/apps/jurumarble/src/app/my/constants/index.ts similarity index 77% rename from apps/jurumarble/src/types/my.ts rename to apps/jurumarble/src/app/my/constants/index.ts index 69d6d681..fffa9866 100644 --- a/apps/jurumarble/src/types/my.ts +++ b/apps/jurumarble/src/app/my/constants/index.ts @@ -1,6 +1,6 @@ export const TAB_LIST = [ { id: 'created-vote', name: '작성한 투표' }, - { id: 'paticipated-vote', name: '참여한 투표' }, + { id: 'participated-vote', name: '참여한 투표' }, { id: 'bookmarked-vote', name: '북마크 투표' }, ] as const; diff --git a/apps/jurumarble/src/app/search/components/DrinkInfoList.tsx b/apps/jurumarble/src/app/search/components/DrinkInfoList.tsx new file mode 100644 index 00000000..c73efe40 --- /dev/null +++ b/apps/jurumarble/src/app/search/components/DrinkInfoList.tsx @@ -0,0 +1,42 @@ +import Path from 'lib/Path'; +import { useRouter } from 'next/navigation'; +import styled from 'styled-components'; + +import DrinkItem from './DrinkItem'; +import { useSearchChangeContext, useSearchValueContext } from '../context'; + +function DrinkInfoList() { + const router = useRouter(); + + const { drinkList, selectedTab } = useSearchValueContext(); + + const { onToggleReplaceLoginPageModal, drinkSubscribe } = + useSearchChangeContext(); + + const onClickDrinkItem = (id: number) => { + router.push(`${Path.DRINK_INFO_PAGE}/${id}`); + }; + + return ( + + {drinkList.map((drinkInfo) => ( + onClickDrinkItem(drinkInfo.id)} + onToggleReplaceLoginPageModal={onToggleReplaceLoginPageModal} + /> + ))} + {selectedTab === 'drinkInfo' &&
} + + ); +} + +const Container = styled.div` + display: flex; + flex-direction: column; + gap: 8px; + margin-top: 24px; +`; + +export default DrinkInfoList; diff --git a/apps/jurumarble/src/app/search/components/DrinkInfoTopSectionItem.tsx b/apps/jurumarble/src/app/search/components/DrinkInfoTopSectionItem.tsx new file mode 100644 index 00000000..733d661e --- /dev/null +++ b/apps/jurumarble/src/app/search/components/DrinkInfoTopSectionItem.tsx @@ -0,0 +1,34 @@ +import { DRINK_INFO_SORT_LIST } from 'lib/constants'; +import styled from 'styled-components'; + +import DrinkInfoList from './DrinkInfoList'; +import RegionSmallSelect from './RegionSmallSelect'; +import SortSelect from './SortSelect'; +import { useSearchChangeContext, useSearchValueContext } from '../context'; + +function DrinkInfoTopSectionItem() { + const { drinkInfoSortOption } = useSearchValueContext(); + const { onChangeDrinkInfoSortOption } = useSearchChangeContext(); + + return ( + <> + + + + + + + ); +} + +const SelectContainer = styled.div` + display: flex; + margin-top: 40px; + gap: 4px; +`; + +export default DrinkInfoTopSectionItem; diff --git a/apps/jurumarble/src/app/search/components/DrinkList.tsx b/apps/jurumarble/src/app/search/components/DrinkList.tsx deleted file mode 100644 index 73599b98..00000000 --- a/apps/jurumarble/src/app/search/components/DrinkList.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import Path from 'lib/Path'; -import { useRouter, useSearchParams } from 'next/navigation'; -import { DrinkInfoSortType } from 'src/types/common'; -import styled from 'styled-components'; - -import DrinkItem from './DrinkItem'; -import useGetDrinkList from '../services/useGetDrinkList'; - -interface Props { - searchText: string; - sortOption: DrinkInfoSortType; - regionOption: string; - isSelectedTab: boolean; - onToggleReplaceLoginPageModal: () => void; -} - -function DrinkList({ - searchText, - sortOption, - regionOption, - onToggleReplaceLoginPageModal, -}: Props) { - const searchParams = useSearchParams(); - const selectedTab = searchParams.get('selectedTab'); - - const { drinkList, subscribe } = useGetDrinkList({ - page: 0, - size: selectedTab === 'drinkInfo' ? 10 : 3, - keyword: searchText, - region: regionOption, - sortBy: sortOption, - }); - - const router = useRouter(); - const onClickDrinkItem = (id: number) => { - router.push(`${Path.DRINK_INFO_PAGE}/${id}`); - }; - - if (!drinkList) { - return <>; - } - - return ( - - {drinkList.map((drinkInfo) => ( - onClickDrinkItem(drinkInfo.id)} - onToggleReplaceLoginPageModal={onToggleReplaceLoginPageModal} - /> - ))} - {selectedTab === 'drinkInfo' &&
} - - ); -} - -const Container = styled.div` - display: flex; - flex-direction: column; - gap: 8px; - margin-top: 24px; -`; - -export default DrinkList; diff --git a/apps/jurumarble/src/app/search/components/DrinkVoteBottomSectionItem.tsx b/apps/jurumarble/src/app/search/components/DrinkVoteBottomSectionItem.tsx new file mode 100644 index 00000000..1f456df0 --- /dev/null +++ b/apps/jurumarble/src/app/search/components/DrinkVoteBottomSectionItem.tsx @@ -0,0 +1,34 @@ +import { DRINK_VOTE_SORT_LIST } from 'lib/constants'; +import styled from 'styled-components'; + +import DrinkVoteList from './DrinkVoteList'; +import RegionSmallSelect from './RegionSmallSelect'; +import SortSelect from './SortSelect'; +import { useSearchChangeContext, useSearchValueContext } from '../context'; + +function DrinkVoteBottomSectionItem() { + const { drinkVoteSortOption } = useSearchValueContext(); + const { onChangeDrinkVoteSortOption } = useSearchChangeContext(); + + return ( + <> + + + + + + + ); +} + +const SelectContainer = styled.div` + display: flex; + margin-top: 40px; + gap: 4px; +`; + +export default DrinkVoteBottomSectionItem; diff --git a/apps/jurumarble/src/app/search/components/DrinkVoteList.tsx b/apps/jurumarble/src/app/search/components/DrinkVoteList.tsx index 5eafee07..0239e302 100644 --- a/apps/jurumarble/src/app/search/components/DrinkVoteList.tsx +++ b/apps/jurumarble/src/app/search/components/DrinkVoteList.tsx @@ -1,35 +1,17 @@ -import { useSearchParams } from 'next/navigation'; import styled from 'styled-components'; import DrinkVoteItem from './DrinkVoteItem'; -import useVoteDrinkService from '../services/useVoteDrinkService'; +import { useSearchChangeContext, useSearchValueContext } from '../context'; -interface Props { - searchText: string; - sortOption: string; - regionOption: string; - isSelectedTab: boolean; - onToggleReplaceLoginPageModal: () => void; -} -function DrinkVoteList({ - searchText, - sortOption, - regionOption, - onToggleReplaceLoginPageModal, -}: Props) { - const searchParams = useSearchParams(); - const selectedTab = searchParams.get('selectedTab'); +function DrinkVoteList() { + const { voteDrinkList, selectedTab } = useSearchValueContext(); + const { onToggleReplaceLoginPageModal, drinkVoteSubscribe } = + useSearchChangeContext(); - const { voteDrinkList, subscribe } = useVoteDrinkService({ - page: 0, - size: 3, - keyword: searchText, - region: regionOption, - sortBy: sortOption, - }); if (!voteDrinkList) { return <>; } + return ( {voteDrinkList.map((voteDrink, index) => ( @@ -39,7 +21,7 @@ function DrinkVoteList({ onToggleReplaceLoginPageModal={onToggleReplaceLoginPageModal} /> ))} - {selectedTab === 'drinkVote' &&
} + {selectedTab === 'drinkVote' &&
} ); } diff --git a/apps/jurumarble/src/app/search/components/NoSearchResult.tsx b/apps/jurumarble/src/app/search/components/NoSearchResult.tsx new file mode 100644 index 00000000..1c94ca10 --- /dev/null +++ b/apps/jurumarble/src/app/search/components/NoSearchResult.tsx @@ -0,0 +1,25 @@ +import Image from 'next/image'; +import { noSearchResult } from 'public/images'; +import styled from 'styled-components'; + +function NoSearchResult() { + return ( + + 검색 결과가 없습니다. + 검색 결과가 없어요. 다른 검색어를 입력해보세요. + + ); +} + +const Container = styled.div` + display: flex; +`; + +const Text = styled.p``; + +export default NoSearchResult; diff --git a/apps/jurumarble/src/app/search/components/RegionSmallSelect.tsx b/apps/jurumarble/src/app/search/components/RegionSmallSelect.tsx index a35c5d06..dbb62f6f 100644 --- a/apps/jurumarble/src/app/search/components/RegionSmallSelect.tsx +++ b/apps/jurumarble/src/app/search/components/RegionSmallSelect.tsx @@ -4,19 +4,19 @@ import { REGION_LIST } from 'lib/constants'; import SvgIcExpandMore from 'src/assets/icons/components/IcExpandMore'; import styled, { css } from 'styled-components'; -interface Props { - defaultOption: string; - onChangeSortOption: (id: string) => void; -} +import { useSearchChangeContext, useSearchValueContext } from '../context'; -function RegionSmallSelect({ defaultOption, onChangeSortOption }: Props) { +function RegionSmallSelect() { const [isOpen, onToggleOpen] = useToggle(); + const { regionOption } = useSearchValueContext(); + const { onChangeRegionOption } = useSearchChangeContext(); + return (