-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2c6b1c
commit 2a35e27
Showing
10 changed files
with
122 additions
and
13 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/components/timeLine/headerNavigatin/HeaderNavigation.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
63
src/components/timeLine/headerNavigatin/HeaderNavigation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |