From d6beb0e082bfe291c30b60fc0de4bd9983a891bd Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 31 Jul 2023 13:43:46 -0400 Subject: [PATCH] Design maintenance (#289) --- packages/core/src/lib/button.svelte | 6 ++++-- packages/legacy/package.json | 2 +- packages/legacy/src/elements/button/button.svelte | 6 ++++-- packages/legacy/src/elements/code-snippet.svelte | 11 +++++++++-- .../elements/context-menu/context-menu-item.svelte | 2 +- packages/legacy/src/elements/icon/icons.ts | 4 ++++ packages/legacy/src/elements/notify.svelte | 8 ++++---- .../legacy/src/elements/select/multiselect.svelte | 2 +- packages/legacy/src/elements/select/select.svelte | 2 +- packages/legacy/src/elements/switch.svelte | 4 ++-- packages/legacy/tests/notify.spec.ts | 8 ++++---- 11 files changed, 35 insertions(+), 20 deletions(-) diff --git a/packages/core/src/lib/button.svelte b/packages/core/src/lib/button.svelte index 57da64bbf..035eaa801 100644 --- a/packages/core/src/lib/button.svelte +++ b/packages/core/src/lib/button.svelte @@ -47,7 +47,8 @@ export let width: 'full' | 'default' = 'default'; {title} class={cx('whitespace-nowrap', 'mx-auto', { 'w-full': width === 'full', - 'h-[30px] w-[30px]': variant === 'icon', + 'h-[30px] w-[30px] text-gray-6 hover:text-gray-7 active:text-gray-8': + variant === 'icon', 'px-3': !icon && variant !== 'icon', 'pl-2 pr-3': icon && variant !== 'icon', 'inline-flex items-center justify-center gap-1.5 border px-3 py-1.5 text-xs': @@ -75,7 +76,8 @@ export let width: 'full' | 'default' = 'default'; {/if} diff --git a/packages/legacy/package.json b/packages/legacy/package.json index a7d260b9e..c0cfd5f9e 100644 --- a/packages/legacy/package.json +++ b/packages/legacy/package.json @@ -1,6 +1,6 @@ { "name": "@viamrobotics/prime", - "version": "0.4.2", + "version": "0.4.3", "license": "Apache-2.0", "type": "module", "files": [ diff --git a/packages/legacy/src/elements/button/button.svelte b/packages/legacy/src/elements/button/button.svelte index 5f33c718c..eb973489a 100644 --- a/packages/legacy/src/elements/button/button.svelte +++ b/packages/legacy/src/elements/button/button.svelte @@ -63,7 +63,8 @@ const handleParentClick = (event: PointerEvent) => { {title} class={cx('whitespace-nowrap', { 'w-full': width === 'full', - 'h-[30px] w-[30px]': variant === 'icon', + 'text-gray-6 hover:text-gray-7 active:text-gray-8 h-[30px] w-[30px]': + variant === 'icon', 'px-3': !icon && variant !== 'icon', 'pl-2 pr-3': icon && variant !== 'icon', 'inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs border': @@ -89,7 +90,8 @@ const handleParentClick = (event: PointerEvent) => { {#if icon} diff --git a/packages/legacy/src/elements/code-snippet.svelte b/packages/legacy/src/elements/code-snippet.svelte index 19c7e621b..4a61c4216 100644 --- a/packages/legacy/src/elements/code-snippet.svelte +++ b/packages/legacy/src/elements/code-snippet.svelte @@ -18,10 +18,13 @@ export let theme: Themes = 'vs'; export let showbutton = 'true'; $: label = 'Copy'; +$: icon = 'content-copy'; +$: isDisabled = false; const dispatch = dispatcher(); let element: HTMLElement; +const disabled = isDisabled; const version = pkg.devDependencies.prismjs.replace('^', ''); @@ -41,7 +44,8 @@ const script = (src: string) => const copyToClipboard = async (event: Event) => { try { await navigator.clipboard.writeText(code); - label = 'Success!'; + label = 'Copied'; + icon = 'check'; dispatch(event, 'copy', { value: 'Successfully copied snippet to the clipboard', }); @@ -54,6 +58,7 @@ const copyToClipboard = async (event: Event) => { window.setTimeout(() => { label = 'Copy'; + icon = 'content-copy'; }, 2000); }; @@ -120,12 +125,14 @@ $: { > {#if showbutton === 'true'} + {/if} diff --git a/packages/legacy/src/elements/context-menu/context-menu-item.svelte b/packages/legacy/src/elements/context-menu/context-menu-item.svelte index 75aa2b542..29d625974 100644 --- a/packages/legacy/src/elements/context-menu/context-menu-item.svelte +++ b/packages/legacy/src/elements/context-menu/context-menu-item.svelte @@ -31,7 +31,7 @@ const handleSelect = (event: Event) => {

= { + alert: mdiAlert, broadcast: mdiBroadcast, cancel: mdiCancel, check: mdiCheck, close: mdiClose, cog: mdiCog, download: mdiDownload, + information: mdiInformation, instagram: mdiInstagram, linkedin: mdiLinkedin, logout: mdiLogout, diff --git a/packages/legacy/src/elements/notify.svelte b/packages/legacy/src/elements/notify.svelte index bac39b62e..1bcc2a334 100644 --- a/packages/legacy/src/elements/notify.svelte +++ b/packages/legacy/src/elements/notify.svelte @@ -56,15 +56,15 @@ const handleClose = (event: Event) => {

{#if variant === 'danger'} - + {:else if variant === 'info'} - + {:else if variant === 'success'} - + {/if} {#if variant === 'warning'} - + {/if}
diff --git a/packages/legacy/src/elements/select/multiselect.svelte b/packages/legacy/src/elements/select/multiselect.svelte index 15686ae73..4c457d2f9 100644 --- a/packages/legacy/src/elements/select/multiselect.svelte +++ b/packages/legacy/src/elements/select/multiselect.svelte @@ -347,7 +347,7 @@ $: { > diff --git a/packages/legacy/src/elements/select/select.svelte b/packages/legacy/src/elements/select/select.svelte index e751dc08d..5714fcbae 100644 --- a/packages/legacy/src/elements/select/select.svelte +++ b/packages/legacy/src/elements/select/select.svelte @@ -326,7 +326,7 @@ $: { > diff --git a/packages/legacy/src/elements/switch.svelte b/packages/legacy/src/elements/switch.svelte index bda79f3d1..980b31d72 100644 --- a/packages/legacy/src/elements/switch.svelte +++ b/packages/legacy/src/elements/switch.svelte @@ -34,7 +34,7 @@ const handleClick = (event: Event) => {
diff --git a/packages/legacy/tests/notify.spec.ts b/packages/legacy/tests/notify.spec.ts index 85427e208..896a969d5 100644 --- a/packages/legacy/tests/notify.spec.ts +++ b/packages/legacy/tests/notify.spec.ts @@ -20,7 +20,7 @@ test('Renders notify with default style if no variant is specified', async ({ ).toBeVisible(); await expect( page.getByTestId('notify-default').locator('v-icon title') - ).toHaveId(/information-outline/u); + ).toHaveId(/information/u); }); test('Renders notify with danger style if the variant is set to danger', async ({ @@ -32,7 +32,7 @@ test('Renders notify with danger style if the variant is set to danger', async ( ).toBeVisible(); await expect( page.getByTestId('notify-variant-danger').locator('v-icon title') - ).toHaveId(/alert-outline/u); + ).toHaveId(/alert-circle/u); }); test('Renders notify with warning style if the variant is set to warning', async ({ @@ -53,7 +53,7 @@ test('Renders notify with success style if the variant is set to success', async ).toBeVisible(); await expect( page.getByTestId('notify-variant-success').locator('v-icon title') - ).toHaveId(/check/u); + ).toHaveId(/check-circle/u); }); test('Renders notify with info style if the variant is set to info', async ({ @@ -65,7 +65,7 @@ test('Renders notify with info style if the variant is set to info', async ({ ).toBeVisible(); await expect( page.getByTestId('notify-variant-info').locator('v-icon title') - ).toHaveId(/information-outline/u); + ).toHaveId(/information/u); }); test('Renders notify slot text', async ({ page }) => {