Merge pull request #2318 from Budibase/quiet-emphasized-tabs
Add Quiet and Emphasized variants to the Tabs and Tab components
This commit is contained in:
commit
a1ab811372
|
@ -30,6 +30,7 @@
|
||||||
on:click={onClick}
|
on:click={onClick}
|
||||||
class:is-selected={$selected.title === title}
|
class:is-selected={$selected.title === title}
|
||||||
class="spectrum-Tabs-item"
|
class="spectrum-Tabs-item"
|
||||||
|
class:emphasized={$selected.title === title && $selected.emphasized}
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
{#if icon}
|
{#if icon}
|
||||||
|
@ -49,3 +50,9 @@
|
||||||
<slot />
|
<slot />
|
||||||
</Portal>
|
</Portal>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.emphasized {
|
||||||
|
color: var(--spectrum-global-color-blue-600);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
export let selected
|
export let selected
|
||||||
export let vertical = false
|
export let vertical = false
|
||||||
export let noPadding = false
|
export let noPadding = false
|
||||||
|
export let quiet = false
|
||||||
|
export let emphasized = false
|
||||||
|
|
||||||
let _id = id()
|
let _id = id()
|
||||||
const tab = writable({ title: selected, id: _id })
|
const tab = writable({ title: selected, id: _id, emphasized })
|
||||||
setContext("tab", tab)
|
setContext("tab", tab)
|
||||||
|
|
||||||
let container
|
let container
|
||||||
|
@ -56,7 +58,9 @@
|
||||||
|
|
||||||
<div
|
<div
|
||||||
bind:this={container}
|
bind:this={container}
|
||||||
class="selected-border spectrum-Tabs spectrum-Tabs--{vertical
|
class:quiet
|
||||||
|
class="selected-border spectrum-Tabs {quiet &&
|
||||||
|
'spectrum-Tabs--quiet'} spectrum-Tabs--{vertical
|
||||||
? 'vertical'
|
? 'vertical'
|
||||||
: 'horizontal'}"
|
: 'horizontal'}"
|
||||||
>
|
>
|
||||||
|
@ -64,7 +68,8 @@
|
||||||
{#if $tab.info}
|
{#if $tab.info}
|
||||||
<div
|
<div
|
||||||
class="spectrum-Tabs-selectionIndicator indicator-transition"
|
class="spectrum-Tabs-selectionIndicator indicator-transition"
|
||||||
style="width: {width}; height: {height}; left: {left}; top: {top};"
|
style="{emphasized &&
|
||||||
|
'background-color: var(--spectrum-global-color-blue-400)'}; width: {width}; height: {height}; left: {left}; top: {top};"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -75,6 +80,10 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.quiet {
|
||||||
|
border-bottom: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.spectrum-Tabs {
|
.spectrum-Tabs {
|
||||||
padding-left: var(--spacing-xl);
|
padding-left: var(--spacing-xl);
|
||||||
padding-right: var(--spacing-xl);
|
padding-right: var(--spacing-xl);
|
||||||
|
|
Loading…
Reference in New Issue