respect reduced motion preference

This commit is contained in:
Vri 🌈 2023-05-17 13:54:02 +02:00
parent 4fe76e19b7
commit e8f74110b5
Signed by: vrifox
GPG key ID: D40098E5B60B2197
6 changed files with 115 additions and 25 deletions

View file

@ -18,6 +18,7 @@
border-radius: 0 2rem 2rem 0;
border: 1px solid var(--sidebar-border);
border-left: 0;
@media (max-width: 1140px) {
overflow: unset;
border: 0;
@ -44,9 +45,13 @@
border-radius: 0.5rem;
pointer-events: none;
opacity: 0%;
transition: opacity 0.3s ease-in-out;
z-index: 201;
@media (prefers-reduced-motion: no-preference) {
transition: opacity 0.3s ease-in-out;
}
}
&::after {
content: "";
transform: translate(-50%, -50%) rotate(45deg);
@ -61,9 +66,14 @@
left: calc(100% + 0.5rem);
pointer-events: none;
opacity: 0%;
transition: opacity 0.3s ease-in-out;
@media (prefers-reduced-motion: no-preference) {
transition: opacity 0.3s ease-in-out;
}
}
&:hover {
&::before, &::after {
opacity: 100%;
}
@ -75,15 +85,21 @@
text-align: center;
user-select: none;
padding: inherit;
#avatar {
border-radius: 300% 500% / 500% 300%;
max-width: 64px;
transition: 0.4s border-radius ease-in-out;
@media (max-width: 1140px) {
position: absolute;
top: 1rem;
left: 1rem;
}
@media (prefers-reduced-motion: no-preference) {
transition: 0.4s border-radius ease-in-out;
}
&:hover {
border-radius: 500% 300% / 300% 500%;
}
@ -92,6 +108,7 @@
#sidebar-menu {
user-select: none;
text-align: center;
@media (max-width: 1140px) {
position: fixed;
width: 100vw;
@ -103,10 +120,12 @@
border: 1px solid var(--sidebar-border);
border-bottom: 0;
}
ul {
list-style: none;
padding: 0;
margin: 0;
@media (max-width: 1140px) {
display: flex;
flex-direction: row;
@ -114,6 +133,7 @@
height: 100%;
}
}
li {
border-radius: 0.5rem;
margin: 0.5em 0;
@ -123,10 +143,15 @@
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.2s linear;
@media (max-width: 1140px) {
margin: 0 0.5rem;
}
@media (prefers-reduced-motion: no-preference) {
transition: background-color 0.2s linear;
}
a {
overflow: visible;
display: flex;
@ -134,6 +159,7 @@
width: 100%;
height: 100%;
}
&::after {
background-color: var(--sidebar-accent-1);
bottom: 0;
@ -146,37 +172,50 @@
z-index: -1;
opacity: 1;
opacity: 0.5;
transition: left 0.5s ease-out, opacity 0.5s ease-out, background-color 0.2s linear, top 0.5s ease-out;
border-radius: 0.5rem;
@media (max-width: 1140px) {
left: 0;
top: 100%;
}
@media (prefers-reduced-motion: no-preference) {
transition: left 0.5s ease-out, opacity 0.5s ease-out, background-color 0.2s linear, top 0.5s ease-out;
}
}
&.active {
background-color: var(--sidebar-accent-1);
&:hover {
background-color: var(--sidebar-accent-2);
}
&:active {
background-color: var(--sidebar-accent-3);
}
}
&:hover {
&::after {
left: 0;
opacity: 1;
@media (max-width: 1140px) {
top: 0;
}
}
}
&:active {
&::after {
background-color: var(--sidebar-accent-2);
}
}
}
a {
text-decoration: none;
display: flex;
@ -194,9 +233,11 @@
aside {
#social-links {
text-align: center;
@media (max-width: 1140px) {
display: none;
}
a {
display: flex;
padding: 1rem;
@ -207,6 +248,7 @@
color: hsl(251.5, 58.9%, 51.4%);
}
}
.mastodon-icon {
color: hsl(239.6, 100%, 69.4%);
}
@ -214,15 +256,18 @@
.icon {
height: 1.25rem;
width: 1.25rem;
transition: color 0.2s ease-in-out;
display: block;
@media (prefers-reduced-motion: no-preference) {
transition: color 0.2s ease-in-out;
}
}
}
}
#languages {
text-align: center;
transition: background-color 0.2s ease-in-out;
border-radius: 0.5rem 0.5rem 1.85rem 0.5rem;
@media (max-width: 1140px) {
border-radius: 4rem;
position: absolute;
@ -238,18 +283,25 @@
justify-content: center;
overflow: hidden;
}
@media (prefers-reduced-motion: no-preference) {
transition: background-color 0.2s ease-in-out;
}
&:hover {
background-color: var(--sidebar-accent-1);
@media (max-width: 1140px) {
background-color: var(--sidebar-accent-2);
}
}
&:active {
background-color: var(--sidebar-accent-2);
@media (max-width: 1140px) {
background-color: var(--sidebar-accent-3);
}
}
#language {
display: block;
text-decoration: none;