cobalt/web/src/components/buttons/Switcher.svelte

59 lines
1.5 KiB
Svelte

<script lang="ts">
export let big: boolean = false;
</script>
<div id="switcher-container" class="switcher" class:big={big}>
<slot></slot>
</div>
<style>
.switcher {
display: flex;
width: auto;
flex-direction: row;
flex-wrap: nowrap;
scrollbar-width: none;
overflow-x: scroll;
border-radius: var(--border-radius);
}
.switcher:not(.big) :global(.button:first-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.switcher:not(.big) :global(.button:last-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.switcher.big {
background: var(--button);
box-shadow: var(--button-box-shadow);
padding: var(--sidebar-inner-padding);
}
.switcher.big :global(.button) {
width: 100%;
height: calc(40px - var(--sidebar-inner-padding) * 1.5);
border-radius: calc(var(--border-radius) - var(--sidebar-inner-padding));;
}
.switcher.big :global(.button:not(:focus-visible)) {
box-shadow: none;
}
.switcher.big :global(.button:not(.active, :hover, :active)) {
background-color: transparent;
}
.switcher:not(.big) :global(.button:not(:first-child, :last-child)) {
border-radius: 0;
}
/* hack to get rid of double border in a list of switches */
.switcher:not(.big) :global(:not(.button:first-child)) {
margin-left: -1.5px;
}
</style>