blog/src/styles/toc.scss

78 lines
1.2 KiB
SCSS

@use "variables";
$tocWidth: 240px;
$tocBreakpoint: variables.$breakpoint + $tocWidth;
.toc-wrapper {
position: relative;
display: flex;
.title {
margin-top: 20px;
}
}
.toc {
height: 100vh;
ul {
list-style-type: none;
padding-inline-start: 0;
li {
font-size: 14px;
display: block;
&:hover {
// background-color: var(--link-hover-color);
}
a {
display: block;
padding: 10px;
color: var(--text-color);
border-left: 4px solid transparent;
border-radius: unset;
&:hover {
background-color: unset;
border-left-color: var(--link-color);
color: var(--link-color);
}
}
&.active {
&:first {
border: 1px solid orange;
}
a {
background-color: var(--link-hover-color);
}
}
}
}
}
@media screen and (max-width: $tocBreakpoint) {
.toc {
display: none;
}
}
@media screen and (min-width: $tocBreakpoint) {
.article {
flex-grow: 1;
}
.toc {
flex: 0 0 $tocWidth;
max-width: $tocWidth;
position: sticky;
top: 0;
padding: 20px;
overflow-y: auto;
}
}