From e8876d3b90572d1696b33cb77f559938511656a6 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 4 Feb 2022 18:22:30 -0800 Subject: [PATCH] Slight update adding Button type Previous type prop renamed to icon --- components/Button/index.scss | 21 ++++++++++++++++++++- components/Button/index.tsx | 33 ++++++++++++++++++++++++--------- public/icons/Cross.svg | 3 +++ 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 public/icons/Cross.svg diff --git a/components/Button/index.scss b/components/Button/index.scss index 818625be..6bd0fdde 100644 --- a/components/Button/index.scss +++ b/components/Button/index.scss @@ -16,7 +16,21 @@ color: $grey-00; .icon svg { - fill: $grey-50; + fill: $grey-00; + } + + .icon.stroke svg { + fill: none; + stroke: $grey-00; + } + } + + &.destructive:hover { + background: $error; + color: white; + + .icon svg { + fill: white; } } @@ -28,6 +42,11 @@ height: 12px; width: 12px; } + + &.stroke svg { + fill: none; + stroke: $grey-50; + } } &.btn-blue { diff --git a/components/Button/index.tsx b/components/Button/index.tsx index b24b1550..d355730f 100644 --- a/components/Button/index.tsx +++ b/components/Button/index.tsx @@ -1,15 +1,22 @@ import React from 'react' import classNames from 'classnames' +import Link from 'next/link' + import AddIcon from '~public/icons/Add.svg' +import CrossIcon from '~public/icons/Cross.svg' +import EditIcon from '~public/icons/Edit.svg' +import LinkIcon from '~public/icons/Link.svg' import MenuIcon from '~public/icons/Menu.svg' import './index.scss' +import { ButtonType } from '~utils/enums' + interface Props { - color: string disabled: boolean - type: string | null + icon: string | null + type: ButtonType click: any } @@ -19,9 +26,9 @@ interface State { class Button extends React.Component { static defaultProps: Props = { - color: 'grey', disabled: false, - type: null, + icon: null, + type: ButtonType.Base, click: () => {} } @@ -34,17 +41,25 @@ class Button extends React.Component { render() { let icon - if (this.props.type === 'new') { + if (this.props.icon === 'new') { icon = - } else if (this.props.type === 'menu') { + } else if (this.props.icon === 'menu') { icon = - } else if (this.props.type === 'link') { + } else if (this.props.icon === 'link') { + icon = + + + } else if (this.props.icon === 'cross') { icon = - + + + } else if (this.props.icon === 'edit') { + icon = + } @@ -52,7 +67,7 @@ class Button extends React.Component { Button: true, 'btn-pressed': this.state.isPressed, 'btn-disabled': this.props.disabled, - [`btn-${this.props.color}`]: true + 'destructive': this.props.type == ButtonType.Destructive }) return