Skip to content

Commit ce574cd

Browse files
authored
Merge pull request #405 from kakao-tech-campus-3rd-step3/feature/main-filter-usability#404
[FEAT] ๋™์•„๋ฆฌ ํƒ์ƒ‰ ํŽ˜์ด์ง€ ํ•„ํ„ฐ ๋ฐ ๋ฐฐ๋„ˆ ์„น์…˜ ๋ฆฌ๋””์ž์ธ #404
2 parents 12d76a2 + 8db03d9 commit ce574cd

File tree

7 files changed

+323
-112
lines changed

7 files changed

+323
-112
lines changed

โ€Žsrc/pages/user/Main/Page.tsxโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import styled from '@emotion/styled';
22
import { useCallback, useState } from 'react';
33
import { BannerSection } from '@/pages/user/Main/components/BannerSection';
44
import { ClubListSection } from '@/pages/user/Main/components/ClubListSection';
5+
import { FiltersSection } from '@/pages/user/Main/components/FiltersSection';
56
import type { RecruitStatus } from './types/club';
67
import type { ClubCategoryEng } from '@/shared/types/club';
78

@@ -20,12 +21,12 @@ export const MainPage = () => {
2021

2122
return (
2223
<Container>
23-
<BannerSection
24+
<BannerSection onChangeSearch={(s: string) => setSearchText(s)} />
25+
<FiltersSection
2426
selectedCategory={categoryFilter}
2527
selectedRecruitStatus={recruitStatus}
2628
onSelectCategory={handleCategoryFilter}
2729
onSelectStatus={handleRecruitStatusFilter}
28-
onChangeSearch={(s: string) => setSearchText(s)}
2930
/>
3031
<ClubListSection
3132
categoryFilter={categoryFilter}

โ€Žsrc/pages/user/Main/components/BannerSection/Banner.styled.tsโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export const BannerWrapper = styled.div(({ theme }) => ({
99
alignItems: 'flex-start',
1010
width: '100%',
1111
maxWidth: '100vw',
12-
height: 400,
12+
height: '300px',
1313
gap: '16px',
1414
boxSizing: 'border-box',
1515
backgroundColor: theme.colors.bg,
1616

1717
[`@media (max-width: ${theme.breakpoints.web})`]: {
18-
minHeight: 300,
18+
minHeight: 240,
1919
gap: 24,
2020
zIndex: 1000,
2121
},

โ€Žsrc/pages/user/Main/components/BannerSection/BannerText.styled.tsโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const BannerTextWrapper = styled.div(({ theme }) => ({
77
gap: '12px',
88
position: 'relative',
99
zIndex: 2,
10+
marginTop: '88px',
1011

1112
[`@media(max-width: ${theme.breakpoints.web})`]: {
1213
gap: '10px',
@@ -33,9 +34,9 @@ export const HeaderText = styled.h2(({ theme }) => ({
3334

3435
export const SubText = styled.p(({ theme }) => ({
3536
fontSize: theme.font.size.lg,
36-
fontWeight: theme.font.weight.regular,
37+
fontWeight: theme.font.weight.medium,
3738
color: 'rgba(255, 255, 255, 0.9)',
38-
textShadow: '0 2px 5px rgba(0, 0, 0, 0.3)',
39+
textShadow: '0 2px 5px rgba(0, 0, 0, 0.5)',
3940
margin: 0,
4041
lineHeight: 1.5,
4142
}));

โ€Žsrc/pages/user/Main/components/BannerSection/ClubSearchInput.tsxโ€Ž

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,21 @@ import { FiSearch } from 'react-icons/fi';
55
const InputWrapper = styled.div(({ theme }) => ({
66
display: 'flex',
77
alignItems: 'center',
8-
width: '400px',
9-
maxWidth: '100%',
10-
border: `1px solid ${theme.colors.border}`,
11-
borderRadius: theme.radius.md,
12-
padding: '10px 10px',
8+
width: '100%',
9+
border: 'none',
10+
borderRadius: '50px',
11+
padding: '16px 28px',
1312
backgroundColor: theme.colors.bg,
1413
boxSizing: 'border-box',
15-
boxShadow: '0 2px 6px rgba(0,0,0,0.1)',
14+
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.15)',
1615

1716
[`@media (max-width: ${theme.breakpoints.web})`]: {
18-
width: 300,
19-
maxWidth: '100%',
17+
padding: '14px 24px',
2018
},
2119

2220
[`@media (max-width: ${theme.breakpoints.mobile})`]: {
23-
gap: 12,
24-
width: '100%',
25-
padding: '8px 12px',
21+
padding: '12px 20px',
22+
borderRadius: '40px',
2623
},
2724
}));
2825

@@ -31,12 +28,28 @@ const Input = styled.input(({ theme }) => ({
3128
border: 'none',
3229
outline: 'none',
3330
fontSize: theme.font.size.base,
31+
backgroundColor: 'transparent',
32+
33+
'::placeholder': {
34+
color: theme.colors.textSecondary,
35+
},
36+
37+
[`@media (max-width: ${theme.breakpoints.mobile})`]: {
38+
fontSize: theme.font.size.sm,
39+
},
3440
}));
3541

36-
const SearchIcon = styled(FiSearch)({
37-
marginRight: '8px',
38-
color: '#666',
39-
});
42+
const SearchIcon = styled(FiSearch)(({ theme }) => ({
43+
marginRight: '12px', // marginLeft โ†’ marginRight
44+
fontSize: '20px',
45+
color: theme.colors.textSecondary,
46+
flexShrink: 0,
47+
48+
[`@media (max-width: ${theme.breakpoints.mobile})`]: {
49+
fontSize: '18px',
50+
marginRight: '8px', // marginLeft โ†’ marginRight
51+
},
52+
}));
4053

4154
type Props = {
4255
onChangeSearch: (s: string) => void;
@@ -50,8 +63,8 @@ export function ClubSearchInput({ onChangeSearch }: Props) {
5063

5164
return (
5265
<InputWrapper>
53-
<Input onChange={handleChange} placeholder='๋™์•„๋ฆฌ๋ฅผ ๊ฒ€์ƒ‰ํ•˜์„ธ์š”.' />
5466
<SearchIcon />
67+
<Input onChange={handleChange} placeholder='๋™์•„๋ฆฌ๋ฅผ ๊ฒ€์ƒ‰ํ•˜์„ธ์š”.' />
5568
</InputWrapper>
5669
);
5770
}
Lines changed: 25 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,14 @@
11
import styled from '@emotion/styled';
2-
import { useSearchParams } from 'react-router-dom';
3-
import { CLUB_CATEGORY } from '@/app/constants/clubCategory';
42
import { ClubSearchInput } from '@/pages/user/Main/components/BannerSection/ClubSearchInput.tsx';
5-
import { CLUB_RECRUIT_STATUS_KOR, type RecruitStatus } from '@/pages/user/Main/types/club.ts';
6-
import { Dropdown } from '@/shared/components/Dropdown/index.tsx';
7-
import {
8-
engToKorCategory,
9-
korToEngCategory,
10-
korToEngRecruitStatus,
11-
} from '@/shared/utils/formatting.ts';
123
import * as S from './Banner.styled.ts';
134
import { BannerSlideshow } from './BannerSlideshow';
145
import * as B from './BannerText.styled.ts';
15-
import type { ClubCategory, ClubCategoryEng } from '@/shared/types/club';
166

17-
type FilterRecruitStatus = RecruitStatus | '์ „์ฒด';
187
type Props = {
198
onChangeSearch: (searchText: string) => void;
20-
onSelectCategory: (category: ClubCategoryEng) => void;
21-
onSelectStatus: (recruitStatus: FilterRecruitStatus) => void;
22-
selectedCategory: ClubCategoryEng;
23-
selectedRecruitStatus: RecruitStatus | undefined;
249
};
2510

26-
export const BannerSection = ({
27-
onChangeSearch,
28-
onSelectCategory,
29-
onSelectStatus,
30-
selectedCategory,
31-
selectedRecruitStatus,
32-
}: Props) => {
33-
const [filterParams, setFilterParams] = useSearchParams();
34-
35-
const handleCategoryClick = (newCategory: ClubCategory) => {
36-
const engCategory = korToEngCategory[newCategory];
37-
onSelectCategory(engCategory);
38-
filterParams.set('category', engCategory);
39-
setFilterParams(filterParams);
40-
};
41-
42-
const handleRecruitStatusClick = (status: RecruitStatus) => {
43-
onSelectStatus(status);
44-
if (status === '์ „์ฒด') {
45-
filterParams.delete('status');
46-
} else {
47-
filterParams.set('status', korToEngRecruitStatus[status]);
48-
}
49-
setFilterParams(filterParams);
50-
};
51-
11+
export const BannerSection = ({ onChangeSearch }: Props) => {
5212
return (
5313
<S.BannerWrapper>
5414
<BannerSlideshow />
@@ -58,25 +18,11 @@ export const BannerSection = ({
5818
<B.HeaderText>ํ•จ๊ป˜ํ•  ์‚ฌ๋žŒ์ด ์žˆ๋Š” ๊ณณ, ๋™์•„๋ฆฌ์›€.</B.HeaderText>
5919
<B.SubText>๊ด€์‹ฌ ์žˆ๋Š” ๋™์•„๋ฆฌ๋ฅผ ์ฐพ๊ณ , ์ฐธ์—ฌํ•ด๋ณด์„ธ์š”.</B.SubText>
6020
</B.BannerTextWrapper>
61-
62-
<SearchContainer>
63-
<ClubSearchInput onChangeSearch={onChangeSearch} />
64-
<DropdownWrapper>
65-
<Dropdown
66-
placeholder='๋™์•„๋ฆฌ ์นดํ…Œ๊ณ ๋ฆฌ'
67-
value={engToKorCategory[selectedCategory]}
68-
options={CLUB_CATEGORY}
69-
onSelect={handleCategoryClick}
70-
/>
71-
<Dropdown
72-
placeholder='๋ชจ์ง‘ ์ƒํƒœ'
73-
value={selectedRecruitStatus === '์ „์ฒด' ? undefined : selectedRecruitStatus}
74-
options={['์ „์ฒด', ...CLUB_RECRUIT_STATUS_KOR] as RecruitStatus[]}
75-
onSelect={handleRecruitStatusClick}
76-
/>
77-
</DropdownWrapper>
78-
</SearchContainer>
7921
</ContentContainer>
22+
23+
<SearchContainer>
24+
<ClubSearchInput onChangeSearch={onChangeSearch} />
25+
</SearchContainer>
8026
</S.BannerWrapper>
8127
);
8228
};
@@ -89,50 +35,39 @@ const ContentContainer = styled.div(({ theme }) => ({
8935
margin: '0 auto',
9036
display: 'flex',
9137
flexDirection: 'column',
92-
gap: '16px',
38+
gap: '24px',
9339
padding: '0 1.5rem',
9440
boxSizing: 'border-box',
41+
paddingBottom: '60px',
9542

9643
[`@media (max-width: ${theme.breakpoints.mobile})`]: {
9744
padding: '0 1rem',
98-
gap: '12px',
45+
paddingBottom: '50px',
46+
gap: '16px',
9947
},
10048
}));
10149

10250
export const SearchContainer = styled.div(({ theme }) => ({
103-
position: 'relative',
51+
position: 'absolute',
52+
bottom: '-30px',
53+
left: '0',
54+
right: '0',
10455
zIndex: 10,
105-
display: 'flex',
106-
flexDirection: 'row',
107-
justifyContent: 'flex-start',
108-
alignItems: 'center',
109-
width: '100%',
110-
gap: 16,
56+
width: '700px',
57+
maxWidth: '90%',
58+
marginLeft: 'max(20px, calc((100vw - 1200px) / 2))',
11159
boxSizing: 'border-box',
112-
opacity: 1,
11360

114-
[`@media(max-width: ${theme.breakpoints.mobile})`]: {
115-
flexDirection: 'column',
116-
gap: 12,
117-
width: '100%',
118-
'& > *': {
119-
width: '100%',
120-
boxSizing: 'border-box',
121-
},
61+
[`@media (max-width: ${theme.breakpoints.web})`]: {
62+
width: '600px',
63+
bottom: '-25px',
64+
marginLeft: '1.5rem',
12265
},
123-
}));
12466

125-
export const DropdownWrapper = styled.div(({ theme }) => ({
126-
display: 'flex',
127-
flexDirection: 'row',
128-
gap: 16,
129-
zIndex: 3,
130-
131-
[`@media(max-width: ${theme.breakpoints.mobile})`]: {
132-
width: '100%',
133-
gap: 12,
134-
'& > *': {
135-
width: 'calc(50% - 6px)',
136-
},
67+
[`@media (max-width: ${theme.breakpoints.mobile})`]: {
68+
width: 'calc(100% - 2rem)',
69+
bottom: '-25px',
70+
marginLeft: '1rem',
71+
marginRight: '1rem',
13772
},
13873
}));

0 commit comments

Comments
ย (0)