Skip to content

Commit

Permalink
add customClass under button components
Browse files Browse the repository at this point in the history
  • Loading branch information
mazmassa committed May 31, 2023
1 parent dc4efa8 commit 5067bd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export const _Primary = {
export const _PrimaryWithLabel = {
render: () => (
<>
<Button preIcon={<FiDisc />} className="w-40">
<Button preIcon={<FiDisc />} customClass="w-40">
<div className="flex items-center">Coins</div>
</Button>
<br />
<br />
<Button className="w-40">
<Button customClass="w-40">
<div className="flex items-center">
Coins
<label className="text-tertiary text-xs flex ml-1 items-center">
Expand Down Expand Up @@ -69,12 +69,12 @@ export const _Secondary = {
export const _SecondaryWithLabel = {
render: () => (
<>
<Button variant="secondary" preIcon={<FiDisc />} className="w-40">
<Button variant="secondary" preIcon={<FiDisc />} customClass="w-40">
<div className="flex items-center">Coins</div>
</Button>
<br />
<br />
<Button variant="secondary" className="w-40">
<Button variant="secondary" customClass="w-40">
<div className="flex items-center">
Coins
<label className="text-c-pressed text-xs flex ml-1 items-center">
Expand Down
5 changes: 3 additions & 2 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
preIcon?: ReactNode;
posIcon?: ReactNode;
variant?: 'secondary' | undefined;
customClass?: string;
}

export function Button(props: ButtonProps) {
const { children, preIcon, posIcon, variant, ...rest } = props;
const { children, preIcon, posIcon, variant, customClass, ...rest } = props;

const primaryClass = `bg-c-default text-primary
hover:bg-c-hover hover:border-c-hover
Expand All @@ -31,8 +32,8 @@ export function Button(props: ButtonProps) {
<button
data-testid="button"
type="button"
className={`default-button px-4 py-3 ${buttonClass} ${customClass}`}
{...rest}
className={`default-button px-4 py-3 ${buttonClass}`}
>
<div className="w-fit m-auto flex gap-2 items-baseline">
<div className="m-auto">
Expand Down
2 changes: 1 addition & 1 deletion src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}

.default-button {
@apply rounded-lg mas-buttons h-12 border border-c-default;
@apply rounded-lg mas-buttons w-full h-12 border border-c-default;
}

.default-tab {
Expand Down

0 comments on commit 5067bd2

Please sign in to comment.