Skip to content

Commit

Permalink
fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
YongChanCho committed Nov 20, 2024
1 parent e2c6b1c commit 2a35e27
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 13 deletions.
Binary file added public/MAPUimg/back_btn_active.png
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 public/MAPUimg/back_btn_inactive.png
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 public/MAPUimg/forward_btn_active.png
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 public/MAPUimg/forward_btn_inactive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions src/assets/user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/components/timeLine/editorList/EditorList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
import React, { useEffect, useState } from 'react';
import { useQuery } from 'react-query';

Expand Down Expand Up @@ -48,3 +49,6 @@ const EditorList: React.FC<EditorListProps> = ({ className, isLog, token }) => {
};

export default EditorList;
=======
import React from "react";
>>>>>>> b00baec9 (feat : add HeaderNavigation component)
33 changes: 33 additions & 0 deletions src/components/timeLine/headerNavigatin/HeaderNavigation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$background: #FFF;

.headerNav {
display: flex;
width: 100%;
height: 48px;
padding: 8px 868px 8px 4px;
align-items: center;
background-color: $background;
border-bottom: 1px solid #F2F5F8;
}

.backbtn, .forwardbtn {
background-color: $background;
width: 32px;
height: 32px;
margin-top: 8px;
padding: 8px;

border: none;
text-align: center;
line-height: 1;
}

.backbtn img, .forwardbtn img {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}

.backbtn {
margin-left: 4px;
}
63 changes: 63 additions & 0 deletions src/components/timeLine/headerNavigatin/HeaderNavigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, { useEffect, useState } from 'react';
import { Link, useLocation, useNavigate, useNavigationType } from 'react-router-dom';
import './HeaderNavigation.scss';

const HeaderNavigation: React.FC = () => {
const navigate = useNavigate();
const location = useLocation();
const navigationType = useNavigationType();

const [isBack, setIsBack] = useState<boolean>(false);
const [isForward, setIsForward] = useState<boolean>(false);

useEffect(() => {
const updateButtonStates = () => {
const idx = window.history.state?.idx ?? 0;
const length = window.history.length;

setIsBack(idx !== 0);
setIsForward(navigationType === 'POP' && idx < length-1);
};

window.addEventListener('popstate', updateButtonStates);

updateButtonStates();

return () => {
window.removeEventListener('popstate', updateButtonStates);
};
}, [location.pathname, navigationType, isForward]);

const handleBack = () => {
if (isBack) {
navigate(-1);
}
};

const handleForward = () => {
if (isForward) {
navigate(1);
}
};

return (
<nav className="headerNav">
<button className="backbtn" onClick={handleBack} disabled={!isBack}>
<img
src={isBack ? '/MAPUimg/back_btn_active.png' : '/MAPUimg/back_btn_inactive.png'}
alt="Back"
/>
</button>

<button className="forwardbtn" onClick={handleForward} disabled={!isForward}>
<img
src={isForward ? '/MAPUimg/forward_btn_active.png' : '/MAPUimg/forward_btn_inactive.png'}
alt="Forward"
/>
</button>
</nav>
);
};

export default HeaderNavigation;

12 changes: 12 additions & 0 deletions src/pages/TimeLine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import HeaderNavigation from '../components/timeLine/headerNavigatin/HeaderNavigation'

const TimeLine = () => {
return (
<>
<HeaderNavigation />
</>
)
}

export default TimeLine
3 changes: 0 additions & 3 deletions svg.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/// <reference types="react-scripts" />
<<<<<<< HEAD
declare module '*.svg' {
const value: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
export default value;
}
=======
>>>>>>> aa93db65 (feat:svg.d.ts file added)

0 comments on commit 2a35e27

Please sign in to comment.