Skip to content

Commit ce26a2f

Browse files
committed
InputBottonCore - added pill style prop
1 parent 80d8f3a commit ce26a2f

3 files changed

Lines changed: 55 additions & 13 deletions

File tree

app/components/forms/input-button/InputButtonCore.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface Props {
2929
type?: InputTypesButton;
3030
theme?: FormUiTheme;
3131
variant?: InputButtonVariant;
32+
isPill?: boolean;
3233
buttonText?: string;
3334
isPending?: boolean;
3435
hasPendingEffect?: boolean;
@@ -40,6 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
4041
type: "button",
4142
theme: "default",
4243
variant: "primary",
44+
isPill: false,
4345
buttonText: "",
4446
isPending: false,
4547
hasPendingEffect: false,
@@ -61,6 +63,7 @@ const buttonClasses = computed(() => [
6163
{ "icon-only": hasIconOnlySlot.value },
6264
{ "pending-effect": props.hasPendingEffect },
6365
{ "is-pending": props.isPending },
66+
{ pill: props.isPill },
6467
]);
6568
6669
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
@@ -128,6 +131,14 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
128131
}
129132
}
130133
134+
&.primary,
135+
&.secondary,
136+
&.tertiary {
137+
&.pill {
138+
border-radius: 100vw;
139+
}
140+
}
141+
131142
/*
132143
* Shared States
133144
**/

app/components/forms/input-button/stories/InputButtonCore.stories.ts

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ export default {
7979
category: "Styling",
8080
},
8181
},
82+
isPill: {
83+
control: "boolean",
84+
description: "Whether button has pill shape",
85+
table: {
86+
category: "Styling",
87+
},
88+
},
8289
styleClassPassthrough: {
8390
control: "object",
8491
description: "Additional CSS classes",
@@ -251,38 +258,46 @@ const Template: StoryFn<InputButtonCoreStoryArgs> = (args) => ({
251258
`,
252259
});
253260

254-
export const WithBothIcons = Template.bind({});
255-
WithBothIcons.args = {
256-
buttonText: "Transfer",
261+
export const ButtonTextOnly = Template.bind({});
262+
ButtonTextOnly.args = {
263+
buttonText: "Button Text Only",
264+
inputVariant: "primary",
265+
useLeftSlot: false,
266+
useRightSlot: false,
267+
};
268+
269+
export const WithBothEmojiIcons = Template.bind({});
270+
WithBothEmojiIcons.args = {
271+
buttonText: "With Both Emoji Icons",
257272
inputVariant: "primary",
258273
useLeftSlot: true,
259274
useRightSlot: true,
260275
leftSlotContent: "💸",
261276
rightSlotContent: "✅",
262277
};
263278

264-
export const WithBothIconComponents = Template.bind({});
265-
WithBothIconComponents.args = {
266-
buttonText: "Navigate",
279+
export const WithBothNuxtIconComponents = Template.bind({});
280+
WithBothNuxtIconComponents.args = {
281+
buttonText: "With Both Nuxt Icon Components",
267282
inputVariant: "primary",
268283
useLeftIcon: true,
269284
useRightIcon: true,
270285
leftIconName: "mdi:arrow-left",
271286
rightIconName: "mdi:arrow-right",
272287
};
273288

274-
export const IconOnly = Template.bind({});
275-
IconOnly.args = {
276-
buttonText: "Icon Only Button",
289+
export const EmojiIconOnly = Template.bind({});
290+
EmojiIconOnly.args = {
291+
buttonText: "Emoji Icon Only Button",
277292
inputVariant: "tertiary",
278293
useIconOnlySlot: true,
279294
iconOnlyContent: "⚡",
280295
};
281296

282-
export const IconOnlyComponent = Template.bind({});
283-
IconOnlyComponent.args = {
284-
buttonText: "Icon Only Button",
297+
export const NuxtIconOnlyComponent = Template.bind({});
298+
NuxtIconOnlyComponent.args = {
299+
buttonText: "Nuxt Icon Only Button",
285300
inputVariant: "tertiary",
286301
useIconOnly: true,
287-
iconOnlyName: "mdi:flash",
302+
iconOnlyName: "mdi:chevron-right-circle-outline",
288303
};

app/components/forms/input-button/tests/InputButtonCore.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ describe("InputButtonCore", () => {
7777
});
7878

7979
describe("Props Handling", () => {
80+
it("applies pill class when isPill prop is true", async () => {
81+
await createWrapper({ isPill: true });
82+
83+
const button = wrapper.find("button");
84+
expect(button.classes()).toContain("pill");
85+
});
86+
87+
it("does not apply pill class when isPill prop is false or omitted", async () => {
88+
await createWrapper({ isPill: false });
89+
const button = wrapper.find("button");
90+
expect(button.classes()).not.toContain("pill");
91+
92+
await createWrapper();
93+
const button2 = wrapper.find("button");
94+
expect(button2.classes()).not.toContain("pill");
95+
});
8096
it("handles type prop correctly", async () => {
8197
await createWrapper({ type: "submit" });
8298

0 commit comments

Comments
 (0)