Remove class property from Icon component

- we discussed and decided to phase out className props
This commit is contained in:
Mattias Granlund 2023-12-05 15:54:57 +01:00
parent ad8c5bdb99
commit a4e3623530
3 changed files with 12 additions and 16 deletions

View File

@ -5,14 +5,12 @@
<script lang="ts">
import iconsJson from './icons.json';
let className = '';
export { className as class };
export let name: keyof typeof iconsJson;
export let color: IconColor = undefined;
</script>
<svg
class={`icon-wrapper ${className}`}
class="icon-wrapper"
class:spinning={name == 'spinner'}
viewBox="0 0 16 16"
fill-rule="evenodd"
@ -29,6 +27,7 @@
.icon-wrapper {
width: 1rem;
height: 1rem;
flex-shrink: 0;
pointer-events: none;
display: inline-block;
}

View File

@ -10,11 +10,13 @@
</script>
<button disabled={selected} class="button" class:selected on:click={() => dispatch('click')}>
<span class="text-base-14 text-bold">
<div class="text-base-14 text-bold">
<slot />
</span>
</div>
{#if icon}
<Icon name={icon} class="button__icon" />
<div class="icon">
<Icon name={icon} />
</div>
{/if}
</button>
@ -31,7 +33,7 @@
&:hover:enabled,
&:focus:enabled {
background-color: var(--clr-theme-container-pale);
& :global(.button__icon) {
& .icon {
color: var(--clr-theme-scale-ntrl-40);
}
}
@ -39,9 +41,8 @@
background-color: var(--clr-theme-container-pale);
color: var(--clr-theme-scale-ntrl-50);
}
}
.button :global(.button__icon) {
color: var(--clr-theme-scale-ntrl-50);
& .icon {
color: var(--clr-theme-scale-ntrl-50);
}
}
</style>

View File

@ -12,7 +12,7 @@
</script>
<a class="item" {href} class:selected transition:slide={{ duration: 250 }}>
<Icon name="branch" class="icon" />
<Icon name="branch" />
<div class="text-color-2 flex-grow truncate">
{branch.name}
{branch.files[0]?.modifiedAt}
@ -34,8 +34,4 @@
.selected {
background-color: var(--clr-theme-container-pale);
}
.item :global(.icon) {
flex-shrink: 0;
}
</style>