feat: 사이드바 Link NavLink로 변경
This commit is contained in:
parent
d915278a7f
commit
928dbcd0ce
@ -1,15 +1,15 @@
|
|||||||
import { Link } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import styles from './SideLink.module.css';
|
import styles from './SideLink.module.css';
|
||||||
|
|
||||||
export default function SideLink({ children, path }) {
|
export default function SideLink({ children, to }) {
|
||||||
return (
|
return (
|
||||||
<li className={styles.list}>
|
<li className={styles.list}>
|
||||||
<Link
|
<NavLink
|
||||||
to={path}
|
to={to}
|
||||||
className={styles.link}
|
className={({ isActive }) => (isActive ? styles.active : styles.link)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Link>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link,
|
||||||
|
.active {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
@ -11,3 +12,8 @@
|
|||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user