My personal website
1import { useNavigate } from 'react-router-dom';
2import * as styles from './BackButton.styles';
3import { BUTTON_TEXT, ICON_PATH, ICON_VIEWBOX, STROKE_WIDTH } from './BackButton.constants';
4
5export default function BackButton() {
6 const navigate = useNavigate();
7
8 return (
9 <button onClick={() => navigate(-1)} className={styles.button}>
10 <svg
11 className={styles.icon}
12 fill="none"
13 stroke="currentColor"
14 viewBox={ICON_VIEWBOX}
15 xmlns="http://www.w3.org/2000/svg"
16 >
17 <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={STROKE_WIDTH} d={ICON_PATH} />
18 </svg>
19 {BUTTON_TEXT}
20 </button>
21 );
22}