Skip to content

Commit

Permalink
bugfix: colors and layout (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrloureed committed Jul 24, 2023
1 parent efc1c27 commit e8de349
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@viamrobotics/prime",
"version": "0.3.5",
"version": "0.3.6",
"license": "Apache-2.0",
"type": "module",
"files": [
Expand Down
10 changes: 5 additions & 5 deletions src/elements/button/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ const handleParentClick = (event: PointerEvent) => {
event.stopImmediatePropagation();
};
let fill = 'danger';
let fill = 'black';
$: {
switch (variant) {
case 'inverse-primary':
case 'danger':
case 'success': {
fill = 'reversed';
fill = 'white';
break;
}
case 'outline-danger':
Expand Down Expand Up @@ -86,10 +86,10 @@ $: {
{title}
class={cx('whitespace-nowrap', {
'h-[30px] w-[30px]': variant === 'icon' || variant === 'icon-danger',
'px-3': !icon && variant !== 'icon',
'pl-2 pr-3': icon && variant !== 'icon',
'px-3': !icon && variant !== 'icon' && variant !== 'icon-danger',
'pl-2 pr-3': icon && variant !== 'icon' && variant !== 'icon-danger',
'inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs border':
variant !== 'icon',
variant !== 'icon' && variant !== 'icon-danger',
'bg-light border-light hover:bg-medium hover:border-medium active:bg-gray-2':
variant === 'primary',
'bg-gray-9 border-gray-9 text-white hover:bg-black hover:border-black active:bg-[#000]':
Expand Down
26 changes: 14 additions & 12 deletions src/elements/icon/icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ export let size: Size = 'base';
const hasNameProperty = Object.hasOwn(paths, name);
</script>

<svg
class={cx(`leading ${sizes[size]}`, {
'inline-block': hasNameProperty,
hidden: !hasNameProperty,
})}
viewBox="0 0 24 24"
aria-labelledby="name"
role="img"
>
<title id={name}>{`${name} icon`}</title>
<path d={paths[name]} fill={fillColor[fill]} />
</svg>
<p class="leading-3">
<svg
class={cx(`${sizes[size]}`, {
'inline-block': hasNameProperty,
hidden: !hasNameProperty,
})}
viewBox="0 0 24 24"
aria-labelledby="name"
role="img"
>
<title id={name}>{`${name} icon`}</title>
<path d={paths[name]} fill={fillColor[fill]} />
</svg>
</p>
9 changes: 1 addition & 8 deletions src/elements/select/select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,7 @@ $: {

{#if tooltip}
<v-tooltip text={tooltip}>
<div
class={cx({
'text-warning-bright': state === 'warn',
'text-danger-dark': state === 'error',
})}
>
<v-icon {fill} name={icon} />
</div>
<v-icon {fill} name={icon} />
</v-tooltip>
{/if}
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/context-menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('Renders style variants', async ({ page }) => {

// variant=danger
await expect(
contextMenu.getByRole('menuitem', { name: 'danger' }).locator('p')
contextMenu.getByRole('menuitem', { name: 'danger' }).locator('p').first()
).toHaveClass(/text-danger-dark/u);
await expect(contextMenu.getByText('danger')).toHaveClass(
/text-danger-dark/u
Expand Down
4 changes: 2 additions & 2 deletions tests/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ test('Given warn state and tooltip value, there should be a warn tooltip next to
}) => {
const select = page.getByTestId('select-warn-tooltip');
const tooltip = select.locator('label > div > v-tooltip').first();
await expect(tooltip.locator('.text-warning-bright')).toBeVisible();
await expect(tooltip).toBeVisible();

// text is not visible
await expect(tooltip.getByText('warn tip').first()).not.toBeVisible();
Expand All @@ -165,7 +165,7 @@ test('Given error state and tooltip value, there should be an error tooltip next
}) => {
const select = page.getByTestId('select-error-tooltip');
const tooltip = select.locator('label > div > v-tooltip').first();
await expect(tooltip.locator('.text-danger-dark')).toBeVisible();
await expect(tooltip).toBeVisible();

// text is not visible
await expect(tooltip.getByText('error tip').first()).not.toBeVisible();
Expand Down

0 comments on commit e8de349

Please sign in to comment.