From 695e72b83a60945a5d3a775ce6bf29e678d4a17d Mon Sep 17 00:00:00 2001 From: andres alcocer Date: Mon, 28 Nov 2022 21:02:53 -0500 Subject: [PATCH] fixed button styling --- src/components/Button/Button.tsx | 21 ++++++++++---- src/components/Button/button.scss | 46 ++++++++++++++++++++++--------- src/components/Header.tsx | 8 ++---- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 8b65913..07de8aa 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -1,4 +1,3 @@ -import React from 'react' import './button.scss' export enum ButtonType { @@ -7,18 +6,28 @@ export enum ButtonType { } interface IButton { - label: string + label?: string onClick?: () => void buttonType: ButtonType - Icon: JSX.Element + Icon?: JSX.Element } const Button = ({ label, onClick, buttonType, Icon }: IButton) => { + const getIconClassName = (): '' | ' with-icon' => { + return Icon ? ' with-icon' : '' + } + + const getLabelClassName = (): '' | ' with-label' => { + return label ? ' with-label' : '' + } + + const getPrimaryClassName = (): string => { + return ButtonType[buttonType ? buttonType : ButtonType.Primary] + } + return (