2025-08-30 12:54:11 -04:00
|
|
|
/* Copyright 2025 The Forgejo Authors. All rights reserved.
|
2025-10-04 23:22:32 -04:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
2025-08-30 12:54:11 -04:00
|
|
|
|
|
|
|
|
:root .switch {
|
2025-10-04 23:22:32 -04:00
|
|
|
/* The resulting switch height is --switch-item-min-height + 2px */
|
|
|
|
|
--switch-item-min-height: 34px;
|
|
|
|
|
--switch-padding-inline: 1.125em;
|
2025-08-30 12:54:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (pointer: coarse) {
|
|
|
|
|
:root .switch {
|
2025-10-04 23:22:32 -04:00
|
|
|
--switch-item-min-height: 38px;
|
2025-08-30 12:54:11 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-05 13:46:47 -05:00
|
|
|
.switch {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-auto-flow: column;
|
2025-01-13 03:28:30 -05:00
|
|
|
height: fit-content;
|
2025-01-05 13:46:47 -05:00
|
|
|
align-items: center;
|
2025-01-13 03:28:30 -05:00
|
|
|
align-self: center;
|
2025-01-05 13:46:47 -05:00
|
|
|
background: var(--color-menu);
|
|
|
|
|
border: 1px solid var(--color-input-border);
|
|
|
|
|
border-radius: var(--border-radius);
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-30 12:54:11 -04:00
|
|
|
.switch > .item {
|
2025-01-13 12:10:43 -05:00
|
|
|
display: flex;
|
2025-04-21 00:25:08 -04:00
|
|
|
gap: 0.5rem;
|
2025-01-13 12:10:43 -05:00
|
|
|
align-items: center;
|
2025-10-04 23:22:32 -04:00
|
|
|
padding-inline: var(--switch-padding-inline);
|
|
|
|
|
min-height: var(--switch-item-min-height);
|
2025-01-13 12:10:43 -05:00
|
|
|
color: var(--color-text);
|
2025-01-05 13:46:47 -05:00
|
|
|
border-radius: var(--border-radius);
|
|
|
|
|
text-wrap: nowrap;
|
2025-08-30 12:54:11 -04:00
|
|
|
transition: background-color 0.1s ease;
|
2025-01-05 13:46:47 -05:00
|
|
|
|
2026-03-08 13:09:13 -04:00
|
|
|
&:hover {
|
|
|
|
|
background: var(--color-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
z-index: 2;
|
|
|
|
|
padding-left: var(--switch-padding-inline);
|
|
|
|
|
background: var(--color-active);
|
|
|
|
|
outline: 1px solid var(--color-input-border);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Prevent default browser styling */
|
|
|
|
|
&button {
|
|
|
|
|
background: transparent;
|
|
|
|
|
}
|
2025-01-05 13:46:47 -05:00
|
|
|
}
|
2025-01-13 12:20:32 -05:00
|
|
|
|
2026-03-08 13:09:13 -04:00
|
|
|
/* Corner rounding aid: item that has to crawl under it's active neighbor,
|
|
|
|
|
so when it is hovered, there are no ugly unpainted v/^ shapes between them */
|
2025-08-30 12:54:11 -04:00
|
|
|
.switch > .item:has(+ .active.item) { /* Active neighbor is next item */
|
|
|
|
|
margin-right: calc(-1 * var(--border-radius));
|
2025-10-04 23:22:32 -04:00
|
|
|
padding-right: calc(var(--switch-padding-inline) + var(--border-radius));
|
2025-08-30 12:54:11 -04:00
|
|
|
}
|
|
|
|
|
.switch > .active.item + .item { /* Active neighbor is previous item */
|
|
|
|
|
margin-left: calc(-1 * var(--border-radius));
|
2025-10-04 23:22:32 -04:00
|
|
|
padding-left: calc(var(--switch-padding-inline) + var(--border-radius));
|
2025-08-30 12:54:11 -04:00
|
|
|
}
|
|
|
|
|
|
2026-03-08 13:09:13 -04:00
|
|
|
/* Make counters embedded into items more visible on brighter backgrounds */
|
|
|
|
|
.switch > .item:is(.active, :hover) > .ui.label {
|
|
|
|
|
background: var(--color-label-bg-alt, var(--color-label-bg));
|
2025-01-13 12:20:32 -05:00
|
|
|
}
|