2021-05-07 03:43:37 +03:00
|
|
|
<script>
|
|
|
|
|
import CaretSortDown20 from "carbon-icons-svelte/lib/CaretSortDown20";
|
|
|
|
|
|
|
|
|
|
let isExpanded = true;
|
|
|
|
|
export let handleClick = () => {};
|
|
|
|
|
export let label = "";
|
2021-05-08 11:47:18 +03:00
|
|
|
export let hideSortIcon = false;
|
|
|
|
|
export let isGroupActive = false;
|
|
|
|
|
// export let subMenuItems = [];
|
2021-05-07 03:43:37 +03:00
|
|
|
|
|
|
|
|
function onClick() {
|
|
|
|
|
isExpanded = !isExpanded;
|
|
|
|
|
handleClick();
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
:global(svg.carbon-icon-sort) {
|
|
|
|
|
position: absolute;
|
2021-05-22 22:25:33 +03:00
|
|
|
top: 8px;
|
2021-05-07 03:43:37 +03:00
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
:global(svg.carbon-icon-minimize) {
|
|
|
|
|
transform: rotate(270deg);
|
2021-05-22 22:25:33 +03:00
|
|
|
top: 13px;
|
2021-05-07 03:43:37 +03:00
|
|
|
left: -6px;
|
|
|
|
|
}
|
2021-05-08 11:47:18 +03:00
|
|
|
|
|
|
|
|
.active {
|
|
|
|
|
background-color: #cae2f9;
|
|
|
|
|
border-left: 3px solid var(--main-primary-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.active span {
|
|
|
|
|
padding-left: 1.3rem;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-22 22:25:33 +03:00
|
|
|
.item span {
|
|
|
|
|
padding: 12px 24px;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-08 11:47:18 +03:00
|
|
|
.item:hover {
|
|
|
|
|
background-color: #cae2f9;
|
|
|
|
|
}
|
2021-05-07 03:43:37 +03:00
|
|
|
</style>
|
2021-05-22 22:25:33 +03:00
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<div
|
|
|
|
|
class="item relative flex items-center {isGroupActive && 'active'}"
|
|
|
|
|
role="button"
|
|
|
|
|
tabindex="0"
|
|
|
|
|
on:click={onClick}>
|
|
|
|
|
{#if !hideSortIcon}
|
|
|
|
|
<CaretSortDown20
|
|
|
|
|
class="carbon-icon-sort {isExpanded ? '' : 'carbon-icon-minimize'}" />
|
|
|
|
|
{/if}
|
|
|
|
|
<span class="font-bold">{label}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{#if isExpanded}
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
|
<slot />
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|