Skip to content

Commit

Permalink
fix: remove classname and icon button from component (#275)
Browse files Browse the repository at this point in the history
Co-authored-by: “BogdanDanilescu” <bogdan.danilescu@nearform.com>
Co-authored-by: Andrea Pregnolato <andrea.pregnolato@nearform.com>
  • Loading branch information
3 people authored Oct 9, 2024
1 parent 5f1d3a6 commit 14c070b
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 39 deletions.
5 changes: 0 additions & 5 deletions packages/html/ds/src/button/button-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ export const buttonSchema = zod.object({
disabled: zod
.boolean({ description: 'Specify if the button should be disabled' })
.optional(),
className: zod
.string({
description: 'Add additional classes',
})
.optional(),
});

export type ButtonProps = zod.infer<typeof buttonSchema>;
3 changes: 1 addition & 2 deletions packages/html/ds/src/button/button.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% from 'button/helpers.html' import getVariantAppearanceClass, getSizeClass, isButtonDisabled %}
{% from 'icon/icon.html' import govieIcon %}
{% from 'helpers/helpers.html' import addClasses %}

{% macro govieButton(props) %}
{% set appearance = props.appearance or 'default' %}
Expand All @@ -12,7 +11,7 @@
data-element="button-container"
data-module="gieds-button"
data-testid="govieButton-{{ appearance }}-{{ variant }}-{{ size }}-{{ isDisabled }}"
class="gi-btn {{ getVariantAppearanceClass(props.disabled, props.variant, props.appearance) | trim }} {{ getSizeClass(props.size) | trim }} {{ isButtonDisabled(props.disabled, props.variant, props.appearance) | trim }} {{ addClasses(props.className) | trim }}"
class="gi-btn {{ getVariantAppearanceClass(props.disabled, props.variant, props.appearance) | trim }} {{ getSizeClass(props.size) | trim }} {{ isButtonDisabled(props.disabled, props.variant, props.appearance) | trim }}"
>
{{ props.content | safe | trim }}
</button>
Expand Down
13 changes: 0 additions & 13 deletions packages/html/ds/src/button/button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ export const Default: Story = {
description: 'Specify if the button is disabled',
type: 'boolean',
},
className: {
control: 'text',
description:
'Specify additional classes ( this can be useful when an icon button needs to be rendered )',
type: 'string',
},
},
args: {
content: 'Button',
Expand All @@ -76,13 +70,6 @@ export const WithIconRight: Story = {
},
};

export const WithoutLabel: Story = {
args: {
content: `<span data-testid="govie-icon" role="presentation" class="material-icons gi-block gi-text-[24px]">thumb_up</span>`,
className: '!gi-p-3',
},
};

export const Disabled: Story = {
args: {
disabled: true,
Expand Down
16 changes: 0 additions & 16 deletions packages/react/ds/src/button/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ export const Default: Story = {
type: { name: 'string' },
description: 'The sizes of the button',
},
label: {
control: 'text',
type: { name: 'string' },
description: 'Label of the Button',
},
disabled: {
control: 'boolean',
description: 'Specify if the button is disabled',
Expand Down Expand Up @@ -90,17 +85,6 @@ export const WithIconRight: Story = {
},
};

export const WithoutLabel: Story = {
args: {
className: '!gi-p-3',
children: (
<Fragment>
<Icon icon="thumb_up" />
</Fragment>
),
},
};

export const Disabled: Story = {
args: {
children: 'Button',
Expand Down
3 changes: 1 addition & 2 deletions packages/react/ds/src/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ export const Button = ({
size,
disabled,
children,
className,
}: ButtonProps) => {
return (
<button
className={`gi-btn ${getVariantAppearanceClass({ disabled, variant, appearance })} ${getSizeClass(size)} ${isButtonDisabled({ disabled, variant, appearance })} ${className}`}
className={`gi-btn ${getVariantAppearanceClass({ disabled, variant, appearance })} ${getSizeClass(size)} ${isButtonDisabled({ disabled, variant, appearance })}`}
>
{children}
</button>
Expand Down
1 change: 0 additions & 1 deletion packages/react/ds/src/button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ export type ButtonProps = {
size?: ButtonSize;
label?: string;
disabled?: boolean;
className?: string;
};

0 comments on commit 14c070b

Please sign in to comment.