2021-05-06 08:22:25 +03:00
|
|
|
<script>
|
2021-05-22 12:32:32 +03:00
|
|
|
import NewButton from "../PrimaryContainedButton/index.svelte";
|
2021-05-06 08:22:25 +03:00
|
|
|
export let title = "";
|
2021-05-29 20:47:46 +03:00
|
|
|
export let overidableStyle = "";
|
2021-05-06 08:22:25 +03:00
|
|
|
export let navItems = [];
|
2021-05-08 11:47:18 +03:00
|
|
|
export let addButtonHref;
|
|
|
|
|
export let addButtonLabel;
|
2021-05-08 22:03:44 +03:00
|
|
|
export let disableSticky = false;
|
2021-07-08 09:44:16 +03:00
|
|
|
|
2021-05-07 03:43:37 +03:00
|
|
|
let dynamicRootClass = "";
|
|
|
|
|
|
|
|
|
|
$: dynamicRootClass =
|
|
|
|
|
Array.isArray(navItems) && navItems.length > 4 ? "bring-down" : "";
|
2021-05-06 08:22:25 +03:00
|
|
|
</script>
|
|
|
|
|
|
2021-06-26 21:32:42 +03:00
|
|
|
<div
|
|
|
|
|
class="header flex items-center justify-between {!disableSticky &&
|
|
|
|
|
'sticky'} {dynamicRootClass}"
|
|
|
|
|
style={overidableStyle}
|
|
|
|
|
>
|
|
|
|
|
{#if !!title}
|
|
|
|
|
<h4 class="title">{title}</h4>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if Array.isArray(navItems) && navItems.length}
|
|
|
|
|
<div class="flex justify-evenly items-center">
|
|
|
|
|
{#each navItems as item}
|
|
|
|
|
<a class="mr-5 text-sm {item.isActive && 'active'}" href={item.href}>
|
|
|
|
|
{item.label}
|
|
|
|
|
</a>
|
|
|
|
|
{/each}
|
|
|
|
|
{#if addButtonHref}
|
|
|
|
|
<NewButton href={addButtonHref} label={addButtonLabel} />
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
<slot name="widget" />
|
|
|
|
|
</div>
|
|
|
|
|
|
2021-05-06 08:22:25 +03:00
|
|
|
<style>
|
|
|
|
|
.header {
|
|
|
|
|
border-bottom: 1px solid var(--border-color);
|
|
|
|
|
padding: 15px;
|
2021-05-07 03:43:37 +03:00
|
|
|
min-height: 61px;
|
2021-05-08 22:03:44 +03:00
|
|
|
background-color: #fff;
|
2021-06-26 21:32:42 +03:00
|
|
|
z-index: 1;
|
2021-05-08 22:03:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header.sticky {
|
2021-05-07 03:43:37 +03:00
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
2021-05-06 08:22:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h4 {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 900;
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.active {
|
|
|
|
|
position: relative;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.active::after {
|
|
|
|
|
position: absolute;
|
|
|
|
|
content: "";
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 3px;
|
|
|
|
|
background-color: var(--main-primary-color);
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-07 03:43:37 +03:00
|
|
|
.header.bring-down {
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
}
|
2021-05-22 12:32:32 +03:00
|
|
|
.spacing {
|
|
|
|
|
flex-grow: 1;
|
|
|
|
|
}
|
2021-05-07 03:43:37 +03:00
|
|
|
|
2021-05-06 08:22:25 +03:00
|
|
|
@media only screen and (max-width: 1002px) {
|
|
|
|
|
.header {
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|