feat: 사이드바 Link NavLink로 변경

This commit is contained in:
jhynsoo 2024-07-21 01:34:25 +09:00
parent d915278a7f
commit 928dbcd0ce
2 changed files with 13 additions and 7 deletions

View File

@ -1,15 +1,15 @@
import { Link } from 'react-router-dom';
import { NavLink } from 'react-router-dom';
import styles from './SideLink.module.css';
export default function SideLink({ children, path }) {
export default function SideLink({ children, to }) {
return (
<li className={styles.list}>
<Link
to={path}
className={styles.link}
<NavLink
to={to}
className={({ isActive }) => (isActive ? styles.active : styles.link)}
>
{children}
</Link>
</NavLink>
</li>
);
}

View File

@ -3,7 +3,8 @@
margin-bottom: 16px;
}
.link {
.link,
.active {
width: 100%;
text-decoration: none;
color: var(--text-color);
@ -11,3 +12,8 @@
line-height: 1.2;
font-weight: 400;
}
.active {
font-weight: 700;
text-decoration: underline;
}