mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-21 15:42:49 +08:00
74 lines
1.7 KiB
CSS
74 lines
1.7 KiB
CSS
.theme-switcher {
|
|
@apply bg-surface-sunken relative inline-flex items-center gap-0 rounded-full shadow-sm transition-transform duration-150 max-md:py-0.5;
|
|
@apply border-hairline border;
|
|
&::before {
|
|
@apply bg-surface-overlay absolute top-1 left-1 z-0 h-[calc(100%-0.5rem)] w-[calc(33.333%-0.5rem)] rounded-full shadow-md transition-transform duration-[250ms] content-[''];
|
|
}
|
|
|
|
footer & {
|
|
@apply max-md:hidden;
|
|
}
|
|
|
|
& .theme-option {
|
|
@apply relative z-10 flex cursor-pointer items-center justify-center gap-1.5 rounded-full px-3 py-1.5 transition-transform duration-150 hover:scale-105 active:scale-95;
|
|
|
|
& input[type="radio"] {
|
|
@apply sr-only;
|
|
}
|
|
|
|
& .theme-icon {
|
|
@apply text-text-muted flex items-center justify-center transition-colors duration-150;
|
|
|
|
& svg {
|
|
@apply size-4 transition-transform duration-150;
|
|
}
|
|
}
|
|
|
|
& .theme-label {
|
|
@apply text-text-muted hidden text-xs font-medium transition-colors duration-150;
|
|
}
|
|
|
|
&.active {
|
|
& .theme-icon {
|
|
@apply text-text;
|
|
|
|
& svg {
|
|
@apply scale-110;
|
|
}
|
|
}
|
|
|
|
& .theme-label {
|
|
@apply text-text;
|
|
}
|
|
}
|
|
|
|
&:hover:not(.active) {
|
|
& .theme-icon {
|
|
@apply text-text;
|
|
}
|
|
|
|
& .theme-label {
|
|
@apply text-text;
|
|
}
|
|
}
|
|
}
|
|
|
|
&:has(.theme-option[data-theme="device"].active) {
|
|
&::before {
|
|
@apply translate-x-0;
|
|
}
|
|
}
|
|
|
|
&:has(.theme-option[data-theme="light"].active) {
|
|
&::before {
|
|
@apply translate-x-[calc(100%+0.5rem)];
|
|
}
|
|
}
|
|
|
|
&:has(.theme-option[data-theme="dark"].active) {
|
|
&::before {
|
|
@apply translate-x-[calc(200%+1rem)];
|
|
}
|
|
}
|
|
}
|