From 04f747aae7f12b9565490f54255fa41487b63bd2 Mon Sep 17 00:00:00 2001 From: Stefanos Hadjipetrou Date: Fri, 13 Sep 2024 14:41:28 +0300 Subject: [PATCH] feat: make use of mui button --- src/components/buttons/button.stories.ts | 1 + src/components/buttons/button.tsx | 91 +++++++++++++++--------- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/src/components/buttons/button.stories.ts b/src/components/buttons/button.stories.ts index 8d87af7..a4438b8 100644 --- a/src/components/buttons/button.stories.ts +++ b/src/components/buttons/button.stories.ts @@ -21,6 +21,7 @@ type Story = StoryObj; export const Filled: Story = { args: { filled: true, + padding: "0px", label: "Button", radius: "circle", backgroundColor: "#000", diff --git a/src/components/buttons/button.tsx b/src/components/buttons/button.tsx index 6a0f73f..482ef7e 100644 --- a/src/components/buttons/button.tsx +++ b/src/components/buttons/button.tsx @@ -1,25 +1,44 @@ /** @jsxImportSource @emotion/react */ import React from "react"; -import { css } from "@emotion/react"; +import Button from "@mui/material/Button"; -type ButtonProps = { +interface ButtonProps extends React.ButtonHTMLAttributes { + gap?: string; + label: string; + color?: string; filled: boolean; + padding?: string; + fontSize?: string; + fontFamily?: string; backgroundColor?: string; size?: "small" | "medium" | "large"; - label: string; - onClick?: () => void; + radius: "rounded" | "sharp" | "circle"; + textTransform?: "uppercase" | "lowercase" | "capitalize"; icon?: { component: React.ReactNode; position: "left" | "right"; }; - color?: string; - radius: "rounded" | "sharp" | "circle"; -}; +} export default function MyButton(props: Readonly) { - const { filled, backgroundColor, size, label, onClick, icon, color, radius } = - props; + const { + gap, + size, + icon, + label, + color, + filled, + radius, + padding, + onClick, + fontSize, + fontFamily, + textTransform, + backgroundColor, + ...otherProps // HTML5 button attributes + } = props; + const radiusSize = { rounded: "30px", sharp: "5px", @@ -35,33 +54,37 @@ export default function MyButton(props: Readonly) { medium: "40px", large: "50px", }; + return ( - + {label} + ); }