Add language switcher

It's a bit WET but hey, better than nothing I guess
This commit is contained in:
daudix
2024-06-16 05:59:33 +03:00
parent 88cf05a654
commit f7dcab6c1d
3 changed files with 94 additions and 11 deletions

View File

@ -31,6 +31,19 @@
list-style: none;
}
a,
#dropdown summary {
&:hover {
box-shadow: var(--edge-highlight);
background-color: var(--fg-muted-1);
color: var(--primary-color);
}
&:active {
transform: scale(var(--active));
}
}
a {
position: relative;
transition: var(--transition);
@ -40,16 +53,9 @@
text-decoration: none;
&:hover {
box-shadow: var(--edge-highlight);
background-color: var(--fg-muted-1);
color: var(--primary-color);
text-decoration: none;
}
&:active {
transform: scale(var(--active));
}
&.active {
&::before {
display: block;
@ -114,7 +120,8 @@
}
}
#feed a {
#feed a,
#dropdown summary {
padding: 0.325rem 0.625rem;
&:hover .icon {
@ -122,10 +129,7 @@
}
.icon {
$icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M1.988 1.988V3c.008.547.453.984 1 .988.004-.004.008-.004.012-.004v.028A8.977 8.977 0 0 1 11.988 13a.991.991 0 0 0 1 .984h1V13h-.004c0-.004 0-.004.004-.008C13.984 7.02 9.184 2.148 3.242 2.02A1.004 1.004 0 0 0 3 1.988v-.004zm0 4V7c.008.547.453.984 1 .988.004-.004.008-.004.012-.004V8a4.985 4.985 0 0 1 4.996 4.844 1.002 1.002 0 0 0 .988 1.145c.008-.005.012-.005.016-.005v.004h.984V13H10c0-3.793-3.047-6.898-6.82-6.992 0-.004-.004-.004-.004-.004A.892.892 0 0 0 3 5.988v-.004zm2 4a1.999 1.999 0 1 0-.002 3.998 1.999 1.999 0 0 0 .002-3.998m0 0'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-image: $icon;
vertical-align: -0.125em;
mask-image: $icon;
transition: var(--transition);
background-color: var(--fg-muted-4);
width: 1rem;
@ -136,5 +140,62 @@
display: none;
}
}
#feed .icon {
$icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M1.988 1.988V3c.008.547.453.984 1 .988.004-.004.008-.004.012-.004v.028A8.977 8.977 0 0 1 11.988 13a.991.991 0 0 0 1 .984h1V13h-.004c0-.004 0-.004.004-.008C13.984 7.02 9.184 2.148 3.242 2.02A1.004 1.004 0 0 0 3 1.988v-.004zm0 4V7c.008.547.453.984 1 .988.004-.004.008-.004.012-.004V8a4.985 4.985 0 0 1 4.996 4.844 1.002 1.002 0 0 0 .988 1.145c.008-.005.012-.005.016-.005v.004h.984V13H10c0-3.793-3.047-6.898-6.82-6.992 0-.004-.004-.004-.004-.004A.892.892 0 0 0 3 5.988v-.004zm2 4a1.999 1.999 0 1 0-.002 3.998 1.999 1.999 0 0 0 .002-3.998m0 0'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-image: $icon;
mask-image: $icon;
}
#dropdown {
details {
position: relative;
border-radius: unset;
background-color: unset;
padding: 0;
summary {
transition: var(--transition);
border-radius: 999px;
background-color: unset;
color: var(--fg-muted-4);
list-style: none;
&::marker,
&::-webkit-details-marker {
display: none;
}
.icon {
$icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M3.98 1v3H1v2h2.947a4.8 4.8 0 0 1-.592 1.871c-.425.758-1.101 1.488-2.062 2.45l1.414 1.413c.92-.92 1.703-1.728 2.283-2.697.38.632.844 1.196 1.377 1.768l.668-2.309a6 6 0 0 1-.41-.625A4.75 4.75 0 0 1 6.033 6h1.53l.511-2H6V1zm5.24 1L6 15h2l.781-3h4.438L14 15h2L12.781 2zm1.562 2h.438l1.5 6H9.28z'/%3E%3C/svg%3E");
-webkit-mask-image: $icon;
mask-image: $icon;
}
}
ul {
-webkit-backdrop-filter: var(--blur);
position: absolute;
left: 50%;
transform: translate(-50%, 1rem);
z-index: 1;
backdrop-filter: var(--blur);
box-shadow: var(--edge-highlight), 0px 12px 24px -16px rgba(0, 0, 0, 0.5);
border-radius: calc(var(--rounded-corner) + 0.25rem);
background-color: var(--nav-bg);
padding: 0.25rem;
text-align: center;
li {
width: 100%;
a {
border-radius: var(--rounded-corner);
width: 100%;
}
}
}
}
}
}
}