Skip to content

Commit

Permalink
Design maintenance (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrloureed committed Jul 31, 2023
1 parent b3ba3bb commit d6beb0e
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 20 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/lib/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -75,7 +76,8 @@ export let width: 'full' | 'default' = 'default';
<Icon
name={icon}
class={cx({
'text-gray-400': variant === 'primary',
'text-gray-6': variant === 'primary',
'text-gray-4': isDisabled,
})}
/>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@viamrobotics/prime",
"version": "0.4.2",
"version": "0.4.3",
"license": "Apache-2.0",
"type": "module",
"files": [
Expand Down
6 changes: 4 additions & 2 deletions packages/legacy/src/elements/button/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -89,7 +90,8 @@ const handleParentClick = (event: PointerEvent) => {
{#if icon}
<v-icon
class={cx({
'text-gray-400': variant === 'primary',
'text-gray-6': variant === 'primary',
'text-gray-4': isDisabled,
})}
name={icon}
/>
Expand Down
11 changes: 9 additions & 2 deletions packages/legacy/src/elements/code-snippet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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('^', '');
Expand All @@ -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',
});
Expand All @@ -54,6 +58,7 @@ const copyToClipboard = async (event: Event) => {
window.setTimeout(() => {
label = 'Copy';
icon = 'content-copy';
}, 2000);
};
Expand Down Expand Up @@ -120,12 +125,14 @@ $: {
></pre>

{#if showbutton === 'true'}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<v-button
class="!text-black !font-sans"
on:click={copyToClipboard}
on:keyup={copyToClipboard}
{label}
icon="content-copy"
{icon}
{disabled}
/>
{/if}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const handleSelect = (event: Event) => {

<p
id={label}
class={cx('font-normal', {
class={cx('text-sm', {
'text-default': variant === 'primary',
'text-danger-dark': variant === 'danger',
})}
Expand Down
4 changes: 4 additions & 0 deletions packages/legacy/src/elements/icon/icons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
mdiAlert,
mdiCameraOutline,
mdiVideoOutline,
mdiAlertCircleOutline,
Expand All @@ -8,6 +9,7 @@ import {
mdiPlus,
mdiClose,
mdiContentCopy,
mdiInformation,
mdiMinus,
mdiSend,
mdiUndo,
Expand Down Expand Up @@ -52,12 +54,14 @@ import {
} from '@mdi/js';

export const paths: Record<string, string> = {
alert: mdiAlert,
broadcast: mdiBroadcast,
cancel: mdiCancel,
check: mdiCheck,
close: mdiClose,
cog: mdiCog,
download: mdiDownload,
information: mdiInformation,
instagram: mdiInstagram,
linkedin: mdiLinkedin,
logout: mdiLogout,
Expand Down
8 changes: 4 additions & 4 deletions packages/legacy/src/elements/notify.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ const handleClose = (event: Event) => {
<div class="flex justify-between w-full gap-2 p-3 relative">
<div class="flex gap-3">
{#if variant === 'danger'}
<v-icon class="text-danger-dark" name="alert-outline" />
<v-icon size="lg" class="text-danger-dark" name="alert-circle" />
{:else if variant === 'info'}
<v-icon class="text-info-dark" name="information-outline" />
<v-icon size="lg" class="text-info-dark" name="information" />
{:else if variant === 'success'}
<v-icon class="text-success-dark" name="check" />
<v-icon size="lg" class="text-success-dark" name="check-circle" />
{/if}

{#if variant === 'warning'}
<v-icon class="text-warning-bright" name="alert-outline" />
<v-icon size="lg" class="text-warning-bright" name="alert" />
{/if}

<figure class="flex flex-col">
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/elements/select/multiselect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ $: {
>
<v-icon
class={cx({
'text-gray-600': !isDisabled && !isReadonly,
'text-gray-6': !isDisabled && !isReadonly,
})}
name="chevron-down"
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/elements/select/select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ $: {
>
<v-icon
class={cx({
'text-gray-600': !isDisabled && !isReadonly,
'text-gray-6': !isDisabled && !isReadonly,
})}
name="chevron-down"
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/legacy/src/elements/switch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const handleClick = (event: Event) => {
</script>

<label
class={cx('flex gap-1 w-fit flex-col justify-start', {
class={cx('flex gap-1 w-fit flex-col justify-start text-default', {
'text-disabled-dark': isDisabled,
})}
>
Expand All @@ -45,7 +45,7 @@ const handleClick = (event: Event) => {

{#if tooltip}
<v-tooltip text={tooltip}>
<v-icon class="-mt-0.5" name="information-outline" />
<v-icon class="text-gray-6 -mt-0.5" name="information-outline" />
</v-tooltip>
{/if}
</div>
Expand Down
8 changes: 4 additions & 4 deletions packages/legacy/tests/notify.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ({
Expand All @@ -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 ({
Expand All @@ -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 ({
Expand All @@ -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 }) => {
Expand Down

0 comments on commit d6beb0e

Please sign in to comment.