Skip to content

Commit

Permalink
Merge pull request #14 from whatever-mentoring/feature/Mypage
Browse files Browse the repository at this point in the history
feat: ๋งˆ์ดํŽ˜์ด์ง€ ์ปดํฌ๋„ŒํŠธ ๋ฐ ํ™ˆ๋ฐ” ์ˆ˜์ •
  • Loading branch information
chaeyeonan authored Sep 19, 2023
2 parents 93411d7 + 2bf717c commit 076e4ff
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
7 changes: 5 additions & 2 deletions src/assets/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { Link } from 'react-router-dom';
import { styled } from 'styled-components';
import { Palette } from 'styles/Palette';

export const EntireContainer = styled.div<{ homebar?: boolean }>`
export const EntireContainer = styled.div<{
homebar?: boolean;
background?: string;
}>`
padding: 25px 30px;
background: ${Palette.White};
background: ${({ background }) => (background ? background : Palette.White)};
height: ${({ homebar }) =>
homebar ? 'calc(100vh - 156px)' : 'calc(100vh - 60px)'};
overflow: auto;
Expand Down
31 changes: 12 additions & 19 deletions src/components/Homebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,37 @@ import mypageOnJuni from '@assets/icons/mypage-on-juni.svg';
import mypageOnCyni from '@assets/icons/mypage-on-cyni.svg';
import Typo from 'styles/Typo';
import { useState } from 'react';
import { Link } from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';

const Homebar = () => {
const { pathname } = useLocation();
let userType = 2; //์ž„์‹œ ๋ณ€์ˆ˜

const [icons, setIcons] = useState({
isAnsOn: false,
isAskOn: false,
isJuicyOn: false,
isMpgOn: false,
});

const handleClick = (iconName: string) => {
setIcons((prevState) => ({
...prevState,
isAnsOn: iconName === 'ans',
isAskOn: iconName === 'ask',
isJuicyOn: iconName === 'juicy',
isMpgOn: iconName === 'mpg',
}));
};

return (
<Container>
{userType == 1 ? (
<Menu to="/" onClick={() => handleClick('ans')}>
<Icon src={`${icons.isAnsOn ? answerOn : answerOff}`} />
<Menu to="/answer">
<Icon src={`${pathname === '/answer' ? answerOn : answerOff}`} />
<Typo.homebar isOn={icons.isAnsOn}>๋‹ต๋ณ€ํ•˜๊ธฐ</Typo.homebar>
</Menu>
) : (
<Menu to="/" onClick={() => handleClick('ask')}>
<Icon src={`${icons.isAskOn ? askOn : askOff}`} />
<Menu to="/answer">
<Icon src={`${pathname === '/answer' ? askOn : askOff}`} />
<Typo.homebar isOn={icons.isAskOn}>์งˆ๋ฌธํ•˜๊ธฐ</Typo.homebar>
</Menu>
)}

<Menu to="/" onClick={() => handleClick('juicy')}>
<Menu to="/">
<Icon
src={`${
icons.isJuicyOn
pathname === '/'
? userType === 1
? juicygeulOnCyni
: juicygeulOnJuni
Expand All @@ -59,10 +51,10 @@ const Homebar = () => {
<Typo.homebar isOn={icons.isJuicyOn}>์ฃผ์”จ๊ธ€</Typo.homebar>
</Menu>

<Menu to="/myPage" onClick={() => handleClick('mpg')}>
<Menu to="/myPage">
<Icon
src={`${
icons.isMpgOn
pathname === '/myPage'
? userType === 1
? mypageOnCyni
: mypageOnJuni
Expand Down Expand Up @@ -98,6 +90,7 @@ const Menu = styled(Link)`
align-items: center;
gap: 3px;
text-decoration: none;
cursor: pointer;
`;
const Icon = styled.img``;
2 changes: 1 addition & 1 deletion src/pages/Mypage/MyComment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const MyComment = () => {
<Header borderBottom={false} btn="back">
๋‚ด๋Œ“๊ธ€
</Header>
<EntireContainer>
<EntireContainer background={`${Palette.Gray05}`}>
<Row>
<Typo.b2 color={Palette.Main}>4</Typo.b2>
<Typo.b2> &nbsp; ๊ฐœ์˜ ๋Œ“๊ธ€</Typo.b2>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Mypage/MyQna/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export const MyQna = () => {
{userType === 0 ? '๋‚ด์งˆ๋ฌธ' : '๋‚ด๋‹ต๋ณ€'}
</Header>
<Waitingtab setNowTab={setNowTab} />
<EntireContainer style={{ height: 'calc(100vh - 101px)' }}>
<EntireContainer
background={`${Palette.Gray05}`}
style={{ height: 'calc(100vh - 101px)' }}
>
<Row>
<Typo.b2>{text} &nbsp;</Typo.b2>
<Typo.b2 color={Palette.Main}>12</Typo.b2>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Mypage/MyScrap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const MyScrap = () => {
<Header borderBottom={false} btn="back">
์Šคํฌ๋žฉ
</Header>
<EntireContainer>
<EntireContainer background={`${Palette.Gray05}`}>
<Row>
<Typo.b2 color={Palette.Main}>4</Typo.b2>
<Typo.b2> &nbsp; ๊ฐœ์˜ ์Šคํฌ๋žฉ</Typo.b2>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Mypage = () => {
>
MY
</Header>
<EntireContainer homebar={true}>
<EntireContainer homebar={true} background={`${Palette.Gray05}`}>
<Row justifyContent="space-between" alignItems="center">
<Column>
<Typo.h4>์•ˆ๋…•ํ•˜์„ธ์š”</Typo.h4>
Expand Down

0 comments on commit 076e4ff

Please sign in to comment.