Skip to content

Commit

Permalink
Merge pull request #19 from MARU-EGG/USER-hader-component
Browse files Browse the repository at this point in the history
[User] Feat: Header component
  • Loading branch information
swgvenghy authored Aug 2, 2024
2 parents 2f5f37f + a524b51 commit df5f085
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/assets/Menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/maru-egg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/routes/app-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React from 'react';
import { Route, Routes } from 'react-router-dom';
import AdminRoutes from './admin-routes';
import PageTest from '../ui/pages/page-test';
import MaruEgg from '../ui/pages/maru-egg';

const AppRoutes: React.FC = () => {
return (
<Routes>
<Route path="/" element={<div>챗봇이 들어갈 곳</div>} />
<Route path="/" element={<MaruEgg />} />
<Route path="/admin/*" element={<AdminRoutes />} />
<Route path="/test/*" element={<PageTest />} />
</Routes>
Expand Down
49 changes: 49 additions & 0 deletions src/ui/components/molecule/user/header/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { ReactComponent as RefreshIcon } from '../../../../../assets/Refresh.svg';
import { ReactComponent as MenuIcon } from '../../../../../assets/Menu.svg';
import maruEgg from '../../../../../assets/maru-egg.png';
import IconButton from '../../../atom/icon/icon-button';

interface HeaderProps {
type: string;
}

const Header = ({ type }: HeaderProps) => {
const navigate = useNavigate();
const [menuOpen, setMenuOpen] = useState(false);

const handleRefreshClick = () => {
navigate('/');
console.log('새로고침');
};

const handleMenuClick = () => {
setMenuOpen(!menuOpen);
};

return (
<div className="flex items-center justify-between px-3 py-2">
<IconButton onClick={handleRefreshClick}>
<RefreshIcon />
</IconButton>
<div className="flex items-center">
<img className="mr-2 h-8 w-8" src={maruEgg} alt="마루에그 캐릭터" />
<div className="mr-8 text-title text-primary-blue">명지대학교 입학처 챗봇</div>
<ul role="list" className="flex list-disc items-center marker:text-primary-blue">
<li className="pl-0">
<div className="flex text-body2">
<p className="text-primary-blue">{type}&nbsp;</p>
<p>질문중</p>
</div>
</li>
</ul>
</div>
<IconButton onClick={handleMenuClick}>
<MenuIcon />
</IconButton>
</div>
);
};

export default Header;
12 changes: 12 additions & 0 deletions src/ui/pages/maru-egg.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import Header from '../components/molecule/user/header/header';

const MaruEgg: React.FC = () => {
return (
<div className="min-w-[360px]">
<Header type="수시" />
</div>
);
};

export default MaruEgg;

0 comments on commit df5f085

Please sign in to comment.