Skip to content

Commit

Permalink
feat: 🎸 [Button] Added button colord
Browse files Browse the repository at this point in the history
✅ Closes: #311
  • Loading branch information
CrisGrud committed Aug 21, 2023
1 parent e9f17bd commit e4459d3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Button/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ VariantOutlined.args = {
...Primary.args,
variant: "outlined",
};

export const Color = Template.bind({});
Color.args = {
...Primary.args,
color: "success",
};
2 changes: 2 additions & 0 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const Button: FC<IButton> = ({
onClick,
style,
variant = "contained",
color = "primary",
}) => {
const icon = useMemo(() => {
const muiIcon: IMUIButtonIcon = {};
Expand Down Expand Up @@ -62,6 +63,7 @@ const Button: FC<IButton> = ({
onClick={onClickHandler}
style={style}
variant={variant}
color={color}
{...icon}
>
{label}
Expand Down
7 changes: 7 additions & 0 deletions src/types/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export enum ButtonVariants {

type IButtonVariants = "contained" | "outlined";

//type ButtonColor = "primary" | "success" | "error" | "secondary";
type ButtonColor = "primary" | "success" | "secondary" | "info" | "error" | "warning";

export type IButtonIcon = Pick<IIcon, "rotate"> & {
component?: ReactElement;
name?: Icons;
Expand Down Expand Up @@ -55,4 +58,8 @@ export interface IButton extends IBaseButton, IDisablableInput, ILocalizable {
* Variant for button shape
*/
variant?: IButtonVariants | ButtonVariants;
/**
* Button color
*/
color?: ButtonColor;
}

0 comments on commit e4459d3

Please sign in to comment.