diff --git a/components/Button/index.scss b/components/Button/index.scss index d437ea45..38318047 100644 --- a/components/Button/index.scss +++ b/components/Button/index.scss @@ -1,35 +1,44 @@ .Button { align-items: center; - background: transparent; + background: var(--button-bg); border: none; - border-radius: 6px; - color: $grey-55; + border-radius: $input-corner; + color: var(--button-text); display: inline-flex; font-size: $font-button; font-weight: $normal; gap: 6px; - padding: 8px 12px; - &:hover { - background: $grey-100; + &:hover, + &.Blended:hover { + background: var(--button-bg-hover); cursor: pointer; - color: $grey-15; + color: var(--button-text-hover); - .icon svg { - fill: $grey-15; + .Accessory svg { + fill: var(--button-text-hover); } - .icon.stroke svg { + .Accessory svg.stroke { fill: none; - stroke: $grey-15; + stroke: var(--button-text-hover); } } + &.Blended { + background: transparent; + } + + &.medium { + height: $unit * 5.5; + padding: ($unit * 1.5) $unit-2x; + } + &.destructive:hover { background: $error; color: $grey-100; - .icon svg { + .Accessory svg { fill: $grey-100; } } @@ -37,7 +46,7 @@ &.save:hover { color: #ff4d4d; - .icon svg { + .Accessory svg { fill: #ff4d4d; stroke: #ff4d4d; } @@ -46,7 +55,7 @@ &.save.Active { color: #ff4d4d; - .icon svg { + .Accessory svg { fill: #ff4d4d; stroke: #ff4d4d; } @@ -73,13 +82,30 @@ } } - .icon { - margin-top: 2px; + .Accessory { + $dimension: $unit-2x; + + display: flex; svg { - fill: $grey-55; - height: 12px; - width: 12px; + fill: var(--button-text); + height: $dimension; + width: $dimension; + + &.stroke { + fill: none; + stroke: var(--button-text); + } + + &.Add { + height: 18px; + width: 18px; + } + + &.Check { + height: 22px; + width: 22px; + } } &.check svg { @@ -88,21 +114,12 @@ width: auto; } - &.stroke svg { - fill: none; - stroke: $grey-55; - } - - &.settings svg { + svg &.settings svg { height: 13px; width: 13px; } } - &.Active { - background: $grey-100; - } - &.btn-blue { background: $blue; color: #8b8b8b; diff --git a/components/Button/index.tsx b/components/Button/index.tsx index 64ab12c7..d09c53b9 100644 --- a/components/Button/index.tsx +++ b/components/Button/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React, { PropsWithChildren, useEffect, useState } from 'react' import classNames from 'classnames' import Link from 'next/link' @@ -15,147 +15,169 @@ import SettingsIcon from '~public/icons/Settings.svg' import './index.scss' import { ButtonType } from '~utils/enums' +import { access } from 'fs' -interface Props { - active?: boolean - disabled?: boolean - classes?: string[] - icon?: string - type?: ButtonType - children?: React.ReactNode - onClick?: (event: React.MouseEvent) => void +interface Props + extends React.DetailedHTMLProps< + React.ButtonHTMLAttributes, + HTMLButtonElement + > { + accessoryIcon?: React.ReactNode + blended?: boolean + size?: 'small' | 'medium' | 'large' + text?: string } -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) +const defaultProps = { + blended: false, + size: 'medium', +} - const classes = classNames( - { - Button: true, - Active: active, - 'btn-pressed': pressed, - 'btn-disabled': disabled, - save: props.icon === 'save', - destructive: props.type == ButtonType.Destructive, - }, - props.classes - ) +const Button = React.forwardRef( + ({ accessoryIcon, blended, size, text, ...props }, forwardedRef) => { + const classes = classNames( + { + Button: true, + Blended: blended, + // Active: active, + // 'btn-pressed': pressed, + // 'btn-disabled': disabled, + // save: props.icon === 'save', + // destructive: props.type == ButtonType.Destructive, + }, + size, + props.className + ) - 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]) - - const addIcon = ( - - - - ) - - const menuIcon = ( - - - - ) - - const linkIcon = ( - - - - ) - - const checkIcon = ( - - - - ) - - 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 'check': - icon = checkIcon - break - case 'cross': - icon = crossIcon - break - case 'edit': - icon = editIcon - break - case 'save': - icon = saveIcon - break - case 'settings': - icon = settingsIcon - break + const hasAccessory = () => { + if (accessoryIcon) + return {accessoryIcon} } - return icon - } + const hasText = () => { + if (text) return {text} + } - function handleMouseDown() { - setPressed(true) - } + return ( + + ) - function handleMouseUp() { - setPressed(false) - } - return ( - - ) -} + // const addIcon = ( + // + // + // + // ) + + // const menuIcon = ( + // + // + // + // ) + + // const linkIcon = ( + // + // + // + // ) + + // const checkIcon = ( + // + // + // + // ) + + // 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 'check': + // icon = checkIcon + // break + // case 'cross': + // icon = crossIcon + // break + // case 'edit': + // icon = editIcon + // break + // case 'save': + // icon = saveIcon + // break + // case 'settings': + // icon = settingsIcon + // break + // } + + // return icon + // } + + // function handleMouseDown() { + // setPressed(true) + // } + + // function handleMouseUp() { + // setPressed(false) + // } + // return ( + // + // ) + } +) + +Button.defaultProps = defaultProps export default Button diff --git a/components/Header/index.scss b/components/Header/index.scss index 7d72517b..0715b1d0 100644 --- a/components/Header/index.scss +++ b/components/Header/index.scss @@ -1,6 +1,6 @@ .Header { display: flex; - height: 34px; + margin-bottom: $unit-2x; width: 100%; &.bottom { @@ -19,10 +19,10 @@ &:hover { padding-right: 50px; - padding-bottom: 16px; .Button { - background: $grey-100; + background: var(--button-bg-hover); + color: var(--button-text-hover); } .Menu { diff --git a/components/HeaderMenu/index.scss b/components/HeaderMenu/index.scss index 1cc4cbb1..ad4f95e1 100644 --- a/components/HeaderMenu/index.scss +++ b/components/HeaderMenu/index.scss @@ -1,24 +1,25 @@ .Menu { - background: $grey-100; + background: var(--menu-bg); border-radius: 6px; display: none; min-width: 220px; position: absolute; top: $unit * 5; // This shouldn't be hardcoded. How to calculate it? + // Also, add space that doesn't make the menu disappear if you move your mouse slowly z-index: 10; } .MenuItem { - color: $grey-50; + color: var(--text-secondary); font-weight: $normal; &:hover:not(.disabled) { - background: $grey-95; - color: $grey-15; + background: var(--menu-bg-item-hover); + color: var(--text-primary); cursor: pointer; a { - color: $grey-15; + color: var(--text-primary); } } @@ -112,8 +113,8 @@ &:hover { i.tag { - background: $grey-60; - color: $grey-100; + background: var(--tag-bg); + color: var(--tag-text); } } @@ -131,7 +132,7 @@ } .MenuGroup { - border-bottom: 1px solid #f5f5f5; + border-bottom: 1px solid var(--menu-separator); &:first-child .MenuItem:first-child:hover { border-top-left-radius: 6px; diff --git a/components/PartyDetails/index.scss b/components/PartyDetails/index.scss index 696bde5a..77c33156 100644 --- a/components/PartyDetails/index.scss +++ b/components/PartyDetails/index.scss @@ -88,6 +88,10 @@ h1 { color: var(--text-primary); + + &.empty { + color: var(--text-tertiary); + } } } } diff --git a/components/PartyDetails/index.tsx b/components/PartyDetails/index.tsx index c28c58ca..59ff9714 100644 --- a/components/PartyDetails/index.tsx +++ b/components/PartyDetails/index.tsx @@ -8,7 +8,6 @@ import Linkify from 'react-linkify' import classNames from 'classnames' import * as AlertDialog from '@radix-ui/react-alert-dialog' -import CrossIcon from '~public/icons/Cross.svg' import Button from '~components/Button' import CharLimitedFieldset from '~components/CharLimitedFieldset' @@ -18,6 +17,10 @@ import TextFieldset from '~components/TextFieldset' import { accountState } from '~utils/accountState' import { appState } from '~utils/appState' +import CheckIcon from '~public/icons/Check.svg' +import CrossIcon from '~public/icons/Cross.svg' +import EditIcon from '~public/icons/Edit.svg' + import './index.scss' import Link from 'next/link' import { formatTimeAgo } from '~utils/timeAgo' @@ -169,11 +172,11 @@ const PartyDetails = (props: Props) => { if (party.editable) { return ( - - + + - {t('buttons.delete')} + {t('buttons.delete')} @@ -236,13 +239,12 @@ const PartyDetails = (props: Props) => { {router.pathname !== '/new' ? deleteButton() : ''}
- - - +
@@ -252,7 +254,9 @@ const PartyDetails = (props: Props) => {
- {party.name ?

{party.name}

: ''} +

+ {party.name ? party.name : 'Untitled'} +

{party.user ? linkedUserBlock(party.user) : userBlock()} {party.raid ? linkedRaidBlock(party.raid) : ''} @@ -270,9 +274,11 @@ const PartyDetails = (props: Props) => {
{party.editable ? ( - + + + + + - ) : ( - '' - )} - + + {copyButton()} + +
) }