Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit c90549a

Browse files
feat: add icon button (#470)
1 parent 7e8f51a commit c90549a

File tree

12 files changed

+557
-4
lines changed

12 files changed

+557
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## v2.0.32
4+
5+
- Add `<IconButton />` component
6+
37
## v2.0.31
48

59
- Adds the icons:

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lob/ui-components",
3-
"version": "2.0.31",
3+
"version": "2.0.32",
44
"engines": {
55
"node": ">=20.2.0",
66
"npm": ">=10.2.0"

src/components/ConditionalWrapper.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<component :is="tag" v-if="tag">
3+
<slot />
4+
</component>
5+
<slot v-else />
6+
</template>
7+
8+
<script setup lang="ts">
9+
defineProps<{
10+
tag?: string;
11+
}>();
12+
</script>
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Canvas, ArgTypes, PRIMARY_STORY } from '@storybook/addon-docs';
2+
import { AllIconButtons, Primary } from './IconButton.stories';
3+
4+
# IconButton
5+
6+
<Canvas of={AllIconButtons} />
7+
8+
## Props
9+
10+
<ArgTypes story={PRIMARY_STORY} />
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import { Meta, StoryFn, StoryObj } from '@storybook/vue3';
2+
import {
3+
IconButtonColor,
4+
IconButtonSize,
5+
IconButtonVariant
6+
} from './constants';
7+
import mdx from './IconButton.mdx';
8+
// @ts-ignore No types from Vue file
9+
import IconButton from './IconButton.vue';
10+
import { IconName } from '../Icon/types';
11+
import routeDecorator, {
12+
routeTemplate
13+
} from '../../../.storybook/routeDecorator';
14+
15+
const meta: Meta<typeof IconButton> = {
16+
title: 'Components/IconButton',
17+
component: IconButton,
18+
decorators: [
19+
routeDecorator('/', [
20+
{
21+
path: '/internal',
22+
name: 'InternalLink',
23+
component: {
24+
template: routeTemplate('internal')
25+
}
26+
}
27+
])
28+
],
29+
parameters: {
30+
docs: {
31+
page: mdx
32+
}
33+
},
34+
argTypes: {
35+
color: {
36+
options: Object.values(IconButtonColor),
37+
control: {
38+
type: 'select'
39+
},
40+
table: {
41+
type: {
42+
summary: Object.values(IconButtonColor).join(' | ')
43+
}
44+
}
45+
},
46+
icon: {
47+
options: Object.values(IconName),
48+
control: {
49+
type: 'select'
50+
},
51+
table: {
52+
type: {
53+
summary: Object.values(IconName).join(' | ')
54+
}
55+
}
56+
},
57+
variant: {
58+
options: Object.values(IconButtonVariant),
59+
control: {
60+
type: 'select'
61+
},
62+
table: {
63+
type: {
64+
summary: Object.values(IconButtonVariant).join(' | ')
65+
}
66+
}
67+
},
68+
size: {
69+
options: Object.values(IconButtonSize),
70+
control: {
71+
type: 'select'
72+
},
73+
table: {
74+
type: {
75+
summary: Object.values(IconButtonSize).join(' | ')
76+
}
77+
}
78+
},
79+
click: {
80+
table: {
81+
type: 'null'
82+
}
83+
}
84+
}
85+
};
86+
87+
export default meta;
88+
89+
export const Primary: StoryObj<typeof IconButton> = {
90+
args: {
91+
icon: IconName.ENVELOPE
92+
}
93+
};
94+
95+
export const AllIconButtons: StoryFn<typeof IconButton> = () => ({
96+
components: { IconButton },
97+
template: `<div class="flex flex-col gap-4 items-center">
98+
${Object.values(IconButtonVariant)
99+
.map(
100+
(variant) =>
101+
`<div class="flex gap-2">
102+
${Object.values(IconButtonColor)
103+
.map(
104+
(color) =>
105+
`<div class="flex flex-col gap-2 items-center">
106+
${Object.values(IconButtonSize)
107+
.map(
108+
(size) =>
109+
`<IconButton icon="Envelope" variant="${variant}" color="${color}" size="${size}" />`
110+
)
111+
.join('')}
112+
</div>`
113+
)
114+
.join('')}
115+
</div>`
116+
)
117+
.join('')}
118+
</div>`
119+
});

0 commit comments

Comments
 (0)