diff --git a/components/BottomHeader/index.tsx b/components/BottomHeader/index.tsx index b57243c8..683e85b0 100644 --- a/components/BottomHeader/index.tsx +++ b/components/BottomHeader/index.tsx @@ -67,9 +67,9 @@ const BottomHeader = () => { const leftNav = () => { if (router.pathname === '/p/[party]' || router.pathname === '/new') { if (app.party.detailsVisible) { - return () + return () } else { - return () + return () } } else { return (
) diff --git a/components/Button/index.scss b/components/Button/index.scss index 4f363ce5..9c60cd60 100644 --- a/components/Button/index.scss +++ b/components/Button/index.scss @@ -134,6 +134,71 @@ color: #bababa; } } + + &.null { + background: $grey-90; + color: $grey-50; + + &:hover { + background: $grey-70; + color: $grey-00; + } + } + + &.wind { + background: $wind-bg-light; + color: $wind-text-dark; + + &:hover { + background: darken($wind-bg-light, 10); + } + } + + &.fire { + background: $fire-bg-light; + color: $fire-text-dark; + + &:hover { + background: darken($fire-bg-light, 10); + } + } + + &.water { + background: $water-bg-light; + color: $water-text-dark; + + &:hover { + background: darken($water-bg-light, 10); + } + } + + &.earth { + background: $earth-bg-light; + color: $earth-text-dark; + + &:hover { + background: darken($earth-bg-light, 10); + } + } + + &.dark { + background: $dark-bg-light; + color: $dark-text-dark; + + &:hover { + background: darken($dark-bg-light, 10); + } + } + + + &.light { + background: $light-bg-light; + color: $light-text-dark; + + &:hover { + background: darken($light-bg-light, 10); + } + } .text { color: inherit; diff --git a/components/Button/index.tsx b/components/Button/index.tsx index 4d670555..3476e473 100644 --- a/components/Button/index.tsx +++ b/components/Button/index.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useEffect, useState } from 'react' import classNames from 'classnames' import Link from 'next/link' @@ -16,80 +16,118 @@ import './index.scss' import { ButtonType } from '~utils/enums' interface Props { - active: boolean - disabled: boolean - icon: string | null - type: ButtonType - click: any + active?: boolean + disabled?: boolean + classes?: string[], + icon?: string + type?: ButtonType + children?: React.ReactNode + onClick?: (event: React.MouseEvent) => void } -interface State { - isPressed: boolean -} +const Button = (props: Props) => { + // States + const [active, setActive] = useState(false) + const [disabled, setDisabled] = useState(false) + const [pressed, setPressed] = useState(false) + const [buttonType, setButtonType] = useState(ButtonType.Base) -class Button extends React.Component { - static defaultProps: Props = { - active: false, - disabled: false, - icon: null, - type: ButtonType.Base, - click: () => {} - } + const classes = classNames({ + Button: true, + 'Active': active, + 'btn-pressed': pressed, + 'btn-disabled': disabled, + 'save': props.icon === 'save', + 'destructive': props.type == ButtonType.Destructive + }, props.classes) - constructor(props: Props) { - super(props) - this.state = { - isPressed: false, - } - } + useEffect(() => { + if (props.active) setActive(props.active) + if (props.disabled) setDisabled(props.disabled) + if (props.type) setButtonType(props.type) + }, [props.active, props.disabled, props.type]) - render() { - let icon - if (this.props.icon === 'new') { - icon = - - - } else if (this.props.icon === 'menu') { - icon = - - - } else if (this.props.icon === 'link') { - icon = - - - } else if (this.props.icon === 'cross') { - icon = - - - } else if (this.props.icon === 'edit') { - icon = - - - } else if (this.props.icon === 'save') { - icon = - - - } else if (this.props.icon === 'settings') { - icon = - - + const addIcon = ( + + + + ) + + const menuIcon = ( + + + + ) + + const linkIcon = ( + + + + ) + + const crossIcon = ( + + + + ) + + const editIcon = ( + + + + ) + + const saveIcon = ( + + + + ) + + const settingsIcon = ( + + + + ) + + function getIcon() { + let icon: React.ReactNode + + switch(props.icon) { + case 'new': icon = addIcon; break + case 'menu': icon = menuIcon; break + case 'link': icon = linkIcon; break + case 'cross': icon = crossIcon; break + case 'edit': icon = editIcon; break + case 'save': icon = saveIcon; break + case 'settings': icon = settingsIcon; break } - const classes = classNames({ - Button: true, - 'Active': this.props.active, - 'btn-pressed': this.state.isPressed, - 'btn-disabled': this.props.disabled, - 'save': this.props.icon === 'save', - 'destructive': this.props.type == ButtonType.Destructive - }) + return icon + } - return - } + ) } export default Button \ No newline at end of file diff --git a/components/GridRep/index.tsx b/components/GridRep/index.tsx index 9aa1df52..8268104f 100644 --- a/components/GridRep/index.tsx +++ b/components/GridRep/index.tsx @@ -115,7 +115,7 @@ const GridRep = (props: Props) => { active={props.favorited} icon="save" type={ButtonType.IconOnly} - click={sendSaveData} + onClick={sendSaveData} /> : ''}
diff --git a/components/TopHeader/index.tsx b/components/TopHeader/index.tsx index eed02d45..b54c9433 100644 --- a/components/TopHeader/index.tsx +++ b/components/TopHeader/index.tsx @@ -107,9 +107,9 @@ const TopHeader = () => { const saveButton = () => { if (party.favorited) - return () + return () else - return () + return () } const rightNav = () => { @@ -119,9 +119,9 @@ const TopHeader = () => { saveButton() : '' } { (router.route === '/p/[party]') ? - : '' + : '' } - +
) } diff --git a/components/WeaponModal/index.tsx b/components/WeaponModal/index.tsx index 6241e935..2feda738 100644 --- a/components/WeaponModal/index.tsx +++ b/components/WeaponModal/index.tsx @@ -14,7 +14,6 @@ import { appState } from '~utils/appState' import CrossIcon from '~public/icons/Cross.svg' import './index.scss' - interface GridWeaponObject { weapon: { element?: number