make flex more consistent, remove transition

This commit is contained in:
Jacky Zhao 2025-03-09 09:57:12 -07:00
parent 2802aa91f4
commit 1176deab7e
5 changed files with 39 additions and 55 deletions

View File

@ -26,9 +26,8 @@ export const defaultContentPageLayout: PageLayout = {
Component.PageTitle(), Component.PageTitle(),
Component.MobileOnly(Component.Spacer()), Component.MobileOnly(Component.Spacer()),
Component.Search(), Component.Search(),
Component.Explorer(),
Component.Darkmode(), Component.Darkmode(),
Component.Explorer(),
], ],
right: [ right: [
Component.Graph(), Component.Graph(),

View File

@ -8,6 +8,7 @@
height: 20px; height: 20px;
margin: 0 10px; margin: 0 10px;
text-align: inherit; text-align: inherit;
flex-shrink: 0;
& svg { & svg {
position: absolute; position: absolute;

View File

@ -30,6 +30,10 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: hidden; overflow-y: hidden;
flex: 0 1 auto;
&.collapsed {
flex: 0 1 1.2em;
}
@media all and ($mobile) { @media all and ($mobile) {
order: -1; order: -1;
@ -63,36 +67,9 @@
} }
} }
button#mobile-explorer,
button#desktop-explorer {
background-color: transparent;
border: none;
text-align: left;
cursor: pointer;
padding: 0;
color: var(--dark);
display: flex;
align-items: center;
& h2 {
font-size: 1rem;
display: inline-block;
margin: 0;
}
& .fold {
margin-left: 0.5rem;
transition: transform 0.3s ease;
opacity: 0.8;
}
.explorer.collapsed > & .fold {
transform: rotateZ(-90deg);
}
}
svg { svg {
pointer-events: all; pointer-events: all;
transition: transform 0.35s ease;
& > polyline { & > polyline {
pointer-events: none; pointer-events: none;
@ -100,23 +77,44 @@
} }
} }
button#mobile-explorer,
button#desktop-explorer {
background-color: transparent;
border: none;
text-align: left;
cursor: pointer;
padding: 0;
color: var(--dark);
display: flex;
align-items: center;
& h2 {
font-size: 1rem;
display: inline-block;
margin: 0;
}
& .fold {
margin-left: 0.5rem;
transition: transform 0.3s ease;
opacity: 0.8;
}
.explorer.collapsed > & .fold {
transform: rotateZ(-90deg);
}
}
#explorer-content { #explorer-content {
list-style: none; list-style: none;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
margin-top: 0.5rem; margin-top: 0.5rem;
.explorer.collapsed > & > ul.overflow {
max-height: 0px;
}
& ul { & ul {
list-style: none; list-style: none;
margin: 0.08rem 0; margin: 0.08rem 0;
padding: 0; padding: 0;
transition:
max-height 0.35s ease,
transform 0.35s ease;
& li > a { & li > a {
color: var(--dark); color: var(--dark);

View File

@ -4,8 +4,10 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
&.desktop-only { overflow-y: hidden;
max-height: 40%; flex: 0 1 auto;
&:has(button#toc.collapsed) {
flex: 0 1 1.2rem;
} }
} }
@ -44,22 +46,7 @@ button#toc {
#toc-content { #toc-content {
list-style: none; list-style: none;
overflow: hidden;
overflow-y: auto;
max-height: 100%;
transition:
max-height 0.35s ease,
visibility 0s linear 0s;
position: relative; position: relative;
visibility: visible;
&.collapsed {
max-height: 0;
transition:
max-height 0.35s ease,
visibility 0s linear 0.35s;
visibility: hidden;
}
& ul { & ul {
list-style: none; list-style: none;

View File

@ -543,7 +543,6 @@ video {
div:has(> .overflow) { div:has(> .overflow) {
display: flex; display: flex;
overflow-y: auto;
max-height: 100%; max-height: 100%;
} }