mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-11-15 16:10:38 +08:00
- Square the dropdown icon - Set the tab bar height to what it is in the design system - Move dropdown button inside the tab
88 lines
1.7 KiB
Svelte
88 lines
1.7 KiB
Svelte
<script lang="ts">
|
|
import type { Snippet } from "svelte";
|
|
|
|
interface Props {
|
|
children: Snippet;
|
|
onclick?: () => void;
|
|
disabled?: boolean;
|
|
active?: boolean;
|
|
flatLeft?: boolean;
|
|
flatRight?: boolean;
|
|
}
|
|
|
|
const {
|
|
children,
|
|
onclick = undefined,
|
|
disabled = false,
|
|
active = false,
|
|
flatLeft = false,
|
|
flatRight = false,
|
|
}: Props = $props();
|
|
</script>
|
|
|
|
<style>
|
|
.container {
|
|
white-space: nowrap;
|
|
|
|
-webkit-touch-callout: none;
|
|
-webkit-user-select: none;
|
|
user-select: none;
|
|
display: flex;
|
|
flex-direction: row;
|
|
font-size: var(--font-size-small);
|
|
height: 38px;
|
|
}
|
|
|
|
.wrapper {
|
|
position: relative;
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
padding: 3px 0;
|
|
align-items: center;
|
|
}
|
|
|
|
.active {
|
|
font-weight: var(--font-weight-semibold);
|
|
color: var(--color-foreground-emphasized);
|
|
}
|
|
|
|
.wrapper.active::after {
|
|
position: absolute;
|
|
z-index: 1;
|
|
content: " ";
|
|
background-color: var(--color-fill-secondary);
|
|
height: 2px;
|
|
bottom: -4px;
|
|
width: 100%;
|
|
}
|
|
|
|
.wrapper:hover:not(.active)::after {
|
|
position: absolute;
|
|
z-index: 1;
|
|
content: " ";
|
|
background-color: var(--color-foreground-dim);
|
|
height: 2px;
|
|
bottom: -4px;
|
|
width: 100%;
|
|
}
|
|
|
|
.container.disabled {
|
|
color: var(--color-foreground-disabled);
|
|
}
|
|
</style>
|
|
|
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
<div
|
|
class="container"
|
|
style:cursor={!disabled ? "pointer" : "default"}
|
|
class:disabled
|
|
class:flat-right={flatRight}
|
|
class:flat-left={flatLeft}
|
|
onclick={!disabled ? onclick : undefined}
|
|
role="button"
|
|
tabindex="0">
|
|
<div class="wrapper" class:active>
|
|
{@render children()}
|
|
</div>
|
|
</div>
|