convert table command buttons to spectrum

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-08 18:04:03 +02:00
parent 2801b77200
commit d8b352a9ae
4 changed files with 23 additions and 13 deletions

View File

@ -31,7 +31,7 @@
"rollup-plugin-postcss": "^4.0.0", "rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-svelte-hot": "^0.11.0", "rollup-plugin-svelte-hot": "^0.11.0",
"semantic-release": "^17.0.8", "semantic-release": "^17.0.8",
"svelte": "^3.29.0", "svelte": "^3.37.0",
"svench": "^0.0.10-7", "svench": "^0.0.10-7",
"vite": "^2.1.5" "vite": "^2.1.5"
}, },
@ -44,6 +44,7 @@
], ],
"dependencies": { "dependencies": {
"@spectrum-css/button": "^3.0.1", "@spectrum-css/button": "^3.0.1",
"@spectrum-css/buttongroup": "^3.0.1",
"@spectrum-css/dialog": "^3.0.1", "@spectrum-css/dialog": "^3.0.1",
"@spectrum-css/divider": "^1.0.1", "@spectrum-css/divider": "^1.0.1",
"@spectrum-css/modal": "^3.0.1", "@spectrum-css/modal": "^3.0.1",

View File

@ -10,6 +10,8 @@
export let size = "M"; export let size = "M";
/** @type {('cta','primary','secondary','warning', 'overBackground')} Type of button */ /** @type {('cta','primary','secondary','warning', 'overBackground')} Type of button */
export let type = "primary" export let type = "primary"
export let quiet = false
export let icon = undefined; export let icon = undefined;
</script> </script>
@ -21,7 +23,7 @@
{href} {href}
{disabled}> {disabled}>
{#if icon} {#if icon}
<svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true" aria-label="{icon}"> <svg class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}" focusable="false" aria-hidden="true" aria-label="{icon}">
<use xlink:href="#spectrum-icon-18-{icon}" /> <use xlink:href="#spectrum-icon-18-{icon}" />
</svg> </svg>
{/if} {/if}
@ -29,11 +31,11 @@
</a> </a>
{:else} {:else}
<button <button
class="spectrum-Button spectrum-Button--{type} spectrum-Button--size{size.toUpperCase()}" class="spectrum-Button spectrum-Button--{type} spectrum-Button--size{size.toUpperCase()} {quiet && 'spectrum-Button--quiet'}"
{disabled} {disabled}
on:click|preventDefault> on:click|preventDefault>
{#if icon} {#if icon}
<svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true" aria-label="{icon}"> <svg class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}" focusable="false" aria-hidden="true" aria-label="{icon}">
<use xlink:href="#spectrum-icon-18-{icon}" /> <use xlink:href="#spectrum-icon-18-{icon}" />
</svg> </svg>
{/if} {/if}

View File

@ -7,7 +7,7 @@
import Context from "../context" import Context from "../context"
export let title = undefined export let title = undefined
export let size export let size = "small"
export let cancelText = "Cancel" export let cancelText = "Cancel"
export let confirmText = "Confirm" export let confirmText = "Confirm"
export let showCancelButton = true export let showCancelButton = true
@ -40,15 +40,17 @@
</section> </section>
{#if showCancelButton || showConfirmButton} {#if showCancelButton || showConfirmButton}
<div class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter"> <div class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter">
<footer class="footer-content"> <!-- <footer class="footer-content">
<slot name="footer" />
</footer> -->
<div class="spectrum-ButtonGroup-item">
<slot name="footer" /> <slot name="footer" />
</footer>
<div class="buttons">
{#if showCancelButton} {#if showCancelButton}
<Button secondary on:click={hide}>{cancelText}</Button> <Button type="secondary" on:click={hide}>{cancelText}</Button>
{/if} {/if}
{#if showConfirmButton} {#if showConfirmButton}
<Button <Button
type="cta"
primary primary
{...$$restProps} {...$$restProps}
disabled={confirmDisabled} disabled={confirmDisabled}

View File

@ -415,6 +415,11 @@
resolved "https://registry.yarnpkg.com/@spectrum-css/button/-/button-3.0.1.tgz#6db8c3e851baecd0f1c2d88fef37d49d01c6e643" resolved "https://registry.yarnpkg.com/@spectrum-css/button/-/button-3.0.1.tgz#6db8c3e851baecd0f1c2d88fef37d49d01c6e643"
integrity sha512-YXrBtjIYisk4Vaxnp0RiE4gdElQX04P2mc4Pi2GlQ27dJKlHmufYcF+kAqGdtiyK5yjdN/vKRcC8y13aA4rusA== integrity sha512-YXrBtjIYisk4Vaxnp0RiE4gdElQX04P2mc4Pi2GlQ27dJKlHmufYcF+kAqGdtiyK5yjdN/vKRcC8y13aA4rusA==
"@spectrum-css/buttongroup@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/buttongroup/-/buttongroup-3.0.1.tgz#99e59cf32ed9a73dacb0c04d260c830ecbafb181"
integrity sha512-/cktRh8N63lCMvcGX/E/8yTBcearuETzZCxm6YDisk3W4Pi68621JVNjxLOB65pf855EHpoZufzLJIRVj+dyOw==
"@spectrum-css/dialog@^3.0.1": "@spectrum-css/dialog@^3.0.1":
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/dialog/-/dialog-3.0.1.tgz#33aae036282159f6aa998848b8c0828640a9620a" resolved "https://registry.yarnpkg.com/@spectrum-css/dialog/-/dialog-3.0.1.tgz#33aae036282159f6aa998848b8c0828640a9620a"
@ -6110,10 +6115,10 @@ svelte-portal@^1.0.0:
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-1.0.0.tgz#36a47c5578b1a4d9b4dc60fa32a904640ec4cdd3" resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-1.0.0.tgz#36a47c5578b1a4d9b4dc60fa32a904640ec4cdd3"
integrity sha512-nHf+DS/jZ6jjnZSleBMSaZua9JlG5rZv9lOGKgJuaZStfevtjIlUJrkLc3vbV8QdBvPPVmvcjTlazAzfKu0v3Q== integrity sha512-nHf+DS/jZ6jjnZSleBMSaZua9JlG5rZv9lOGKgJuaZStfevtjIlUJrkLc3vbV8QdBvPPVmvcjTlazAzfKu0v3Q==
svelte@^3.29.0: svelte@^3.37.0:
version "3.36.0" version "3.37.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.36.0.tgz#3fc4c6fc7a04c3d4249b4fcccae28fc14f442f64" resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.37.0.tgz#dc7cd24bcc275cdb3f8c684ada89e50489144ccd"
integrity sha512-LSmdCYoAS6kzLff9nejB5KK5FBJaqyiivs7hPl0OJZ+OxiggI8lMAhvo5W3y8vSP0IWS5++Yb5EbKuQdzOSIoA== integrity sha512-TRF30F4W4+d+Jr2KzUUL1j8Mrpns/WM/WacxYlo5MMb2E5Qy2Pk1Guj6GylxsW9OnKQl1tnF8q3hG/hQ3h6VUA==
svench@^0.0.10-7: svench@^0.0.10-7:
version "0.0.10-7" version "0.0.10-7"