Skip to content

Commit

Permalink
Merge branch 'frontend' into feature/fe/#358-footprint
Browse files Browse the repository at this point in the history
  • Loading branch information
juwon5272 authored Dec 2, 2024
2 parents 4cf868b + b6c1259 commit ed2fccc
Show file tree
Hide file tree
Showing 15 changed files with 234 additions and 122 deletions.
10 changes: 0 additions & 10 deletions frontend/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import type { Preview } from '@storybook/react';
import '../src/index.css';
// 우선은 폰트 다 포함시켰는데, 나중에 사용할 것들만 따로 뺴자.
import '@fontsource/pretendard/100.css';
import '@fontsource/pretendard/200.css';
import '@fontsource/pretendard/300.css';
import '@fontsource/pretendard/400.css';
import '@fontsource/pretendard/500.css';
import '@fontsource/pretendard/600.css';
import '@fontsource/pretendard/700.css';
import '@fontsource/pretendard/800.css';
import '@fontsource/pretendard/900.css';

const preview: Preview = {
parameters: {
Expand Down
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@fontsource/pretendard": "^5.1.0",
"axios": "^1.7.7",
"lz-string": "^1.5.0",
"react": "^18.3.1",
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#root {
touch-action: pan-y;
font-family: Pretendard, 'Pretendard Variable', sans-serif;
font-family: Pretendard, 'Pretendard Variable', sans-serif !important;
}

.logo {
Expand Down Expand Up @@ -40,10 +40,10 @@
}

.disable-drag {
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

.overlay {
Expand Down
19 changes: 16 additions & 3 deletions frontend/src/component/content/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getChannelInfo } from '@/api/channel.api';
import { useContext } from 'react';
import { ChannelContext } from '@/context/ChannelContext';
import { Dropdown } from '../common/dropdown/Dropdown';
import { FooterContext } from '../layout/footer/LayoutFooterProvider';

interface IContentProps {
title: string;
Expand Down Expand Up @@ -35,6 +36,7 @@ interface IContentProps {
*/

export const Content = (props: IContentProps) => {
const { resetFooterContext } = useContext(FooterContext);
const formattedDate = new Date(props.time).toLocaleDateString('ko-KR', {
year: 'numeric',
month: '2-digit',
Expand All @@ -61,9 +63,15 @@ export const Content = (props: IContentProps) => {
const goToChannelInfoPage = () => {
if (channelInfo?.id) {
navigate(`/channelInfo/${channelInfo.id}`);
resetFooterContext();
}
};

const goToHostViewPage = () => {
navigate(props.link);
resetFooterContext();
};

const handleUpdate = () => {
getUpdateChannelInfo();
goToChannelInfoPage();
Expand All @@ -85,7 +93,7 @@ export const Content = (props: IContentProps) => {
{props.person > 0 && (
<>
<MdGroup className="mr-2 h-5 w-5" aria-label="인원수 아이콘" />
<span>{props.person}</span>
<span className="text-xs font-normal">{props.person}</span>
</>
)}
</section>
Expand All @@ -101,10 +109,15 @@ export const Content = (props: IContentProps) => {
<MdMoreVert className="h-6 w-6" />
</Dropdown.Trigger>
<Dropdown.Menu>
<Dropdown.Item className="flex items-start text-base" onClick={handleUpdate}>
<Dropdown.Item
className="flex items-start text-base font-normal"
onClick={handleUpdate}
>
공유하기
</Dropdown.Item>
<Dropdown.Item className="flex items-start text-base">삭제하기</Dropdown.Item>
<Dropdown.Item className="flex items-start text-base font-normal">
삭제하기
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</div>
Expand Down
42 changes: 42 additions & 0 deletions frontend/src/component/header/HeaderLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ReactNode } from 'react';
import classNames from 'classnames';

interface IHeaderProps {
leftItems?: ReactNode[];
rightItems?: ReactNode[];
title?: ReactNode;
subtitle?: string;
className?: string;
userName?: string;
}

export const HeaderLayout = (props: IHeaderProps) => {
return (
<header
className={classNames(
'absolute flex w-full flex-col gap-2.5 bg-transparent px-4 pb-2 pt-4',
props.className,
)}
>
<div className="flex items-center justify-between">
<div className="flex items-center gap-1">
{props.leftItems &&
props.leftItems.map(item => (
<div className="flex items-center justify-center">{item}</div>
))}
<div className="flex items-center justify-center text-base">
<div className="font-bold">{props.userName}</div>
<div>{props.title}</div>
</div>
</div>
<div className="flex items-center gap-1">
{props.rightItems &&
props.rightItems.map(item => (
<div className="flex items-center justify-center">{item}</div>
))}
</div>
</div>
<div className="text-grayscale-400 ml-8 text-xs">{props.subtitle}</div>
</header>
);
};
26 changes: 15 additions & 11 deletions frontend/src/component/layout/constant/HeaderConst.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { HeaderBackButton } from '@/component/header/HeaderBackButton';
import { HeaderDropdown } from '@/component/header/HeaderDropdown';
import React, { ReactNode } from 'react';

export const HEADER_TITLE: Record<string, string> = {
'/add-channel/:user/draw': '에 따른 경로 설정',
};
Expand All @@ -6,17 +10,17 @@ export const HEADER_SUBTITLE: Record<string, string> = {
'/add-channel/:user/draw': '사용자 별로 출발지/도착지(마커), 경로(그림)을 설정할 수 있습니다',
};

export const HEADER_LEFTBUTTON: Record<string, string> = {
'/add-channel': 'back',
'/add-channel/:user': 'back',
'/add-channel/:user/draw': 'back',
'/channel/:channelId/host': 'back',
'/update-channel': 'back',
'/register': 'back',
'/channelInfo/:channelId': 'back',
'/guest-add-channel/:channelId': 'back',
export const HEADER_LEFTITEMS: Record<string, ReactNode[]> = {
'/add-channel': [React.createElement(HeaderBackButton)],
'/add-channel/:user': [React.createElement(HeaderBackButton)],
'/add-channel/:user/draw': [React.createElement(HeaderBackButton)],
'/channel/:channelId/host': [React.createElement(HeaderBackButton)],
'/update-channel': [React.createElement(HeaderBackButton)],
'/register': [React.createElement(HeaderBackButton)],
'/channelInfo/:channelId': [React.createElement(HeaderBackButton)],
'/guest-add-channel/:channelId': [React.createElement(HeaderBackButton)],
};

export const HEADER_RIGHTBUTTON: Record<string, string> = {
'/channel/:channelId/host': 'dropdown',
export const HEADER_RIGHTITEMS: Record<string, ReactNode[]> = {
'/channel/:channelId/host': [React.createElement(HeaderDropdown)],
};
24 changes: 9 additions & 15 deletions frontend/src/component/layout/header/LayoutHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import { Header } from '@/component/header/Header';
import { NoticeText } from '@/component/text/NoticeText';
import { useLocation, useParams } from 'react-router-dom';
import { getHeaderInfo } from '@/utils/mapping/HeaderMapping';
import { HeaderLayout } from '@/component/header/HeaderLayout';

export const LayoutHeader = () => {
const params = useParams<Record<string, string | undefined>>();
const urlPath = useLocation();
const headerOption = getHeaderInfo(urlPath.pathname);

return (
<Header className="z-4000">
<Header.MainLayout
leftButton={headerOption.leftButton}
rightButton={headerOption.rightButton}
title={`${params.user || ''}${headerOption.title}`}
/>
{headerOption.subtitle && (
<Header.Subtitle>
<NoticeText>{headerOption.subtitle}</NoticeText>
</Header.Subtitle>
)}
</Header>
<HeaderLayout
className="z-[5000]"
userName={`${params.user || ''}`}
title={`${headerOption.title}`}
subtitle={`${headerOption.subtitle}`}
leftItems={headerOption.leftItems}
rightItems={headerOption.rightItems}
/>
);
};
133 changes: 108 additions & 25 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,87 @@
box-sizing: border-box; /* padding과 border를 box 크기에 포함 */
}

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
Expand All @@ -43,32 +111,47 @@ time, mark, audio, video {
}

/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
font-family: Pretendard, 'Pretendard Variable', sans-serif;
font-family: Pretendard, 'Pretendard Variable', sans-serif !important;
}
ol, ul {
ol,
ul {
list-style: none;
}
blockquote, q {
blockquote,
q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
span, a, img {
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none
span,
a,
img {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
Loading

0 comments on commit ed2fccc

Please sign in to comment.