diff --git a/web/components/menu.css b/web/components/menu.css --- a/web/components/menu.css +++ b/web/components/menu.css @@ -2,33 +2,61 @@ background-color: transparent; border: none; cursor: pointer; - color: var(--thread-top-bar-menu-color); + color: inherit; +} + +div.menuActionListContainer { + position: relative; + z-index: 4; } div.menuActionList { position: absolute; - right: 10px; - top: 55px; z-index: 1; display: flex; flex-direction: column; background-color: var(--menu-bg); + color: var(--menu-color); border-radius: 4px; padding: 4px 0; + line-height: 1.5; + min-width: max-content; +} + +div.menuActionListLight { + background-color: var(--menu-bg-light); + color: var(--menu-color-light); +} + +div.menuActionListMedium { + font-size: var(--m-font-16); +} + +div.menuActionListSmall { + font-size: var(--xs-font-12); +} + +div.menuActionListBottom { + top: 40px; + right: 0; +} + +div.menuActionListLeft { + top: 0; + right: 5px; } button.menuAction { z-index: 1; background-color: transparent; padding: 12px 16px; - color: var(--menu-color); - background-color: var(--menu-bg); - font-size: var(--m-font-16); line-height: 1.5; border: none; cursor: pointer; display: flex; align-items: center; + color: inherit; + font-size: inherit; } button.menuAction:hover { @@ -36,11 +64,10 @@ } div.menuActionIcon { - font-size: var(--l-font-18); + font-size: 1.125em; display: flex; justify-content: center; margin-right: 8px; - width: 20px; } button.menuActionDangerous { diff --git a/web/components/menu.react.js b/web/components/menu.react.js --- a/web/components/menu.react.js +++ b/web/components/menu.react.js @@ -1,18 +1,31 @@ // @flow +import classnames from 'classnames'; import * as React from 'react'; import css from './menu.css'; +type MenuPosition = 'left' | 'right' | 'bottom'; +type MenuSize = 'small' | 'medium'; + type MenuProps = { icon: React.Node, children: $ReadOnlyArray, + position?: MenuPosition, + size?: MenuSize, + light?: boolean, }; function Menu(props: MenuProps): React.Node { const [isOpen, setIsOpen] = React.useState(false); - const { icon, children } = props; + const { + icon, + children, + position = 'bottom', + size = 'medium', + light = false, + } = props; const closeMenuCallback = React.useCallback(() => { document.removeEventListener('click', closeMenuCallback); @@ -39,7 +52,19 @@ let menuActionList = null; if (isOpen) { - menuActionList =
{children}
; + const menuActionListClasses = classnames(css.menuActionList, { + [css.menuActionListBottom]: position === 'bottom', + [css.menuActionListLeft]: position === 'left', + [css.menuActionListMedium]: size === 'medium', + [css.menuActionListSmall]: size === 'small', + [css.menuActionListLight]: light, + }); + + menuActionList = ( +
+
{children}
+
+ ); } return ( diff --git a/web/theme.css b/web/theme.css --- a/web/theme.css +++ b/web/theme.css @@ -103,8 +103,10 @@ --text-message-default-background: var(--shades-black-80); --message-action-tooltip-bg: var(--shades-black-90); --menu-bg: var(--shades-black-90); + --menu-bg-light: var(--shades-black-80); --menu-separator-color: var(--shades-black-80); --menu-color: var(--shades-black-60); + --menu-color-light: var(--shades-white-60); --menu-color-hover: var(--shades-white-100); --menu-color-dangerous: var(--error-primary); --menu-color-dangerous-hover: var(--error-light-50);