Skip to content

Commit 3d04186

Browse files
authored
Design maintenance prime 14 feb 2024 (#483)
1 parent 01ef668 commit 3d04186

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@viamrobotics/prime-core",
3-
"version": "0.0.89",
3+
"version": "0.0.90",
44
"publishConfig": {
55
"access": "public"
66
},

packages/core/src/lib/button/__tests__/icon-button.spec.ts

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ describe('IconButton', () => {
2121
);
2222
});
2323

24+
it('Renders a button in the style of the secondary variant if variant is specified as secondary', () => {
25+
render(IconButton, { ...common, variant: 'secondary' });
26+
expect(screen.getByRole('button')).toHaveClass('border-light', 'bg-light');
27+
});
28+
2429
it('Renders a button in the style of danger if the variant is specified as danger', () => {
2530
render(IconButton, { ...common, variant: 'danger' });
2631
expect(screen.getByRole('button')).toHaveClass(

packages/core/src/lib/button/icon-button.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export let disabled = false;
2727
export let type: 'button' | 'submit' | 'reset' = 'button';
2828
2929
/** The communicated action type to the user. */
30-
export let variant: 'primary' | 'danger' = 'primary';
30+
export let variant: 'primary' | 'secondary' | 'danger' = 'primary';
3131
3232
/** Additional CSS classes to pass to the button. */
3333
let extraClasses: cx.Argument = '';
@@ -48,6 +48,8 @@ $: handleDisabled = preventHandler(disabled);
4848
'cursor-not-allowed text-gray-4': disabled,
4949
'hover:text-gray-7 active:text-gray-8':
5050
variant === 'primary' && !disabled,
51+
'border-light bg-light hover:border-medium hover:bg-medium active:border-medium active:bg-gray-2':
52+
variant === 'secondary' && !disabled,
5153
'hover:bg-danger-dark hover:bg-opacity-[0.08] hover:text-danger-dark active:bg-[rgba(190,53,54,0.16)] active:text-danger-dark':
5254
variant === 'danger' && !disabled,
5355
},

packages/core/src/lib/code-snippet.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,6 @@ figure pre[class*='language-'] {
192192
193193
figure pre[class*='language-'] > code[class*='language-'] {
194194
font-family: 'Roboto Mono Variable', 'Roboto Mono', ui-monospace, monospace;
195+
font-size: 1em;
195196
}
196197
</style>

packages/storybook/src/stories/icon-button.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import { IconButton } from '@viamrobotics/prime-core';
1515
<Story of={IconButtonStories.Primary} />
1616
</Canvas>
1717

18+
<Canvas>
19+
<Story of={IconButtonStories.Secondary} />
20+
</Canvas>
21+
1822
<Canvas>
1923
<Story of={IconButtonStories.Danger} />
2024
</Canvas>

packages/storybook/src/stories/icon-button.stories.svelte

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ import { IconButton } from '@viamrobotics/prime-core';
1212
/>
1313
</Story>
1414

15+
<Story name="Secondary">
16+
<IconButton
17+
icon="plus"
18+
label="Add secondary object"
19+
variant="secondary"
20+
/>
21+
</Story>
22+
1523
<Story name="Danger">
1624
<IconButton
1725
icon="trash-can-outline"

0 commit comments

Comments
 (0)