Rename IconButtonInner to InnerButton, as it does not necessarily contain an Icon
This commit is contained in:
parent
a12e39a15f
commit
0269c97b2e
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import ButtonItem from "./ButtonItem.svelte";
|
import ButtonItem from "./ButtonItem.svelte";
|
||||||
import IconButtonInner from "./IconButtonInner.svelte";
|
import InnerButton from "./InnerButton.svelte";
|
||||||
|
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let icon = "";
|
export let icon = "";
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ButtonItem>
|
<ButtonItem>
|
||||||
<IconButtonInner {className} {active} {onClick}>
|
<InnerButton {className} {active} {onClick}>
|
||||||
{@html icon}
|
{@html icon}
|
||||||
</IconButtonInner>
|
</InnerButton>
|
||||||
</ButtonItem>
|
</ButtonItem>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import ButtonItem from "./ButtonItem.svelte";
|
import ButtonItem from "./ButtonItem.svelte";
|
||||||
import IconButtonInner from "./IconButtonInner.svelte";
|
import InnerButton from "./InnerButton.svelte";
|
||||||
|
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let icon = "";
|
export let icon = "";
|
||||||
@ -8,7 +8,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ButtonItem>
|
<ButtonItem>
|
||||||
<IconButtonInner {className} active={false} {onClick}>
|
<InnerButton {className} {onClick}>
|
||||||
{@html icon}
|
{@html icon}
|
||||||
</IconButtonInner>
|
</InnerButton>
|
||||||
</ButtonItem>
|
</ButtonItem>
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
export let className: string;
|
export let className: string = '';
|
||||||
export let onClick: (event: ClickEvent) => void;
|
export let onClick: (event: ClickEvent) => void;
|
||||||
export let active: boolean;
|
export let active = false;
|
||||||
|
export let disabled = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
button {
|
button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
|
||||||
|
background-color: white;
|
||||||
vertical-align: -webkit-baseline-middle;
|
vertical-align: -webkit-baseline-middle;
|
||||||
padding: 2px;
|
|
||||||
|
|
||||||
& > :global(svg),
|
& > :global(svg),
|
||||||
& > :global(img) {
|
& > :global(img) {
|
||||||
@ -27,9 +29,27 @@
|
|||||||
&:active, &.active {
|
&:active, &.active {
|
||||||
box-shadow: inset 0 0 10px 3px rgb(0 0 0 / 30%);
|
box-shadow: inset 0 0 10px 3px rgb(0 0 0 / 30%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
opacity: 0.4;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active, &.active {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<button class={className} class:active on:click={onClick} on:mousedown|preventDefault>
|
<button
|
||||||
|
class="p-1 {className}"
|
||||||
|
class:active
|
||||||
|
{disabled}
|
||||||
|
on:click={onClick}
|
||||||
|
on:mousedown|preventDefault
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</button>
|
</button>
|
Loading…
Reference in New Issue
Block a user