From ae345d2c458bd0952d9b85c2e03060b2d286d320 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 12 Feb 2024 17:26:08 +0200 Subject: [PATCH] buttons look great now, including unstyled ones menu items work too --- src/App.scss | 19 ++-- .../account_actions/account_actions.vue | 5 -- src/components/button.style.js | 52 ++++++----- src/components/button_unstyled.style.js | 88 +++++++++++++++++++ src/components/chat_message/chat_message.vue | 2 +- src/components/emoji_input/emoji_input.vue | 1 - src/components/emoji_picker/emoji_picker.scss | 16 +--- src/components/emoji_picker/emoji_picker.vue | 8 +- .../extra_buttons/extra_buttons.vue | 24 ++--- src/components/input.style.js | 5 +- src/components/menu_item.style.js | 10 ++- .../mobile_post_status_button.vue | 2 - .../moderation_tools/moderation_tools.vue | 22 ++--- src/components/nav_panel/nav_panel.vue | 16 ++-- .../navigation/navigation_entry.vue | 7 +- src/components/navigation/navigation_pins.vue | 12 +-- .../notifications/notification_filters.vue | 14 +-- src/components/panel.style.js | 1 + src/components/panel_header.style.js | 3 +- src/components/popover.style.js | 1 + src/components/popover/popover.vue | 62 +------------ .../post_status_form/post_status_form.vue | 25 ------ .../quick_filter_settings.vue | 14 +-- .../quick_view_settings.vue | 12 +-- .../scope_selector/scope_selector.js | 8 +- .../scope_selector/scope_selector.vue | 5 -- .../admin_tabs/frontends_tab.vue | 4 +- .../settings_modal/settings_modal.vue | 6 +- src/components/status/status.scss | 5 -- src/components/top_bar.style.js | 1 + src/components/user_card/user_card.scss | 13 --- .../user_list_menu/user_list_menu.vue | 2 +- .../theme_data/theme_data_3.service.js | 8 +- 33 files changed, 224 insertions(+), 249 deletions(-) create mode 100644 src/components/button_unstyled.style.js diff --git a/src/App.scss b/src/App.scss index 1f9bab407b..27fee4b4a3 100644 --- a/src/App.scss +++ b/src/App.scss @@ -372,14 +372,24 @@ nav { } } +.menu-item { + border: none; + outline: none; + text-align: initial; + font-size: inherit; + font-family: inherit; + cursor: pointer; + color: inherit; +} + .button-unstyled { - background: none; border: none; outline: none; display: inline; text-align: initial; font-size: 100%; font-family: inherit; + box-shadow: var(--shadow); padding: 0; line-height: unset; cursor: pointer; @@ -393,13 +403,6 @@ nav { &.-fullwidth { width: 100%; } - - &.-hover-highlight { - &:hover svg { - color: $fallback--lightText; - color: var(--lightText, $fallback--lightText); - } - } } input, diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index ce19291a1d..1c3c1419cd 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -130,11 +130,6 @@ margin: -0.5em 0; padding: 0.5em 0; text-align: center; - - &:not(:hover) .icon { - color: $fallback--lightText; - color: var(--lightText, $fallback--lightText); - } } } diff --git a/src/components/button.style.js b/src/components/button.style.js index 5a5e42716d..8d19516f39 100644 --- a/src/components/button.style.js +++ b/src/components/button.style.js @@ -10,6 +10,14 @@ const border = (top, shadow) => ({ const buttonInsetFakeBorders = [border(true, false), border(false, true)] const inputInsetFakeBorders = [border(true, true), border(false, false)] +const buttonOuterShadow = { + x: 0, + y: 0, + blur: 2, + spread: 0, + color: '#000000', + alpha: 1 +} const hoverGlow = { x: 0, @@ -22,7 +30,7 @@ const hoverGlow = { export default { name: 'Button', // Name of the component - selector: '.button', // CSS selector/prefix + selector: '.button-default', // CSS selector/prefix // outOfTreeSelector: '' // out-of-tree selector is used when other components are laid over it but it's not part of the tree, see Underlay component // States, system witll calculate ALL possible combinations of those and prepend "normal" to them + standalone "normal" state states: { @@ -39,8 +47,8 @@ export default { // Variants are mutually exclusive, each component implicitly has "normal" variant, and all other variants inherit from it. variants: { // Variants save on computation time since adding new variant just adds one more "set". - normal: '-default', // you can override normal variant, it will be appenended to the main class - danger: '-default.danger' + // normal: '', // you can override normal variant, it will be appenended to the main class + danger: '.danger' // Overall the compuation difficulty is N*((1/6)M^3+M) where M is number of distinct states and N is number of variants. // This (currently) is further multipled by number of places where component can exist. }, @@ -56,21 +64,7 @@ export default { // like within it directives: { background: '--fg', - shadow: [{ - x: 0, - y: 0, - blur: 2, - spread: 0, - color: '#000000', - alpha: 1 - }, ...buttonInsetFakeBorders] - } - }, - { - variant: 'unstyled', - directives: { - background: '--fg', - opacity: 0 + shadow: [buttonOuterShadow, ...buttonInsetFakeBorders] } }, { @@ -82,7 +76,7 @@ export default { { state: ['pressed'], directives: { - shadow: [...inputInsetFakeBorders] + shadow: [buttonOuterShadow, ...inputInsetFakeBorders] } }, { @@ -95,7 +89,7 @@ export default { state: ['toggled'], directives: { background: '--accent,-24.2', - shadow: [...inputInsetFakeBorders] + shadow: [buttonOuterShadow, ...inputInsetFakeBorders] } }, { @@ -112,6 +106,13 @@ export default { shadow: [...buttonInsetFakeBorders] } }, + { + state: ['disabled', 'hover'], + directives: { + background: '$blend(--background, 0.25, --parent)', + shadow: [...buttonInsetFakeBorders] + } + }, { component: 'Text', parent: { @@ -122,6 +123,17 @@ export default { textOpacity: 0.25, textOpacityMode: 'blend' } + }, + { + component: 'Text', + parent: { + component: 'Button', + state: ['disabled', 'hover'] + }, + directives: { + textOpacity: 0.25, + textOpacityMode: 'blend' + } } ] } diff --git a/src/components/button_unstyled.style.js b/src/components/button_unstyled.style.js new file mode 100644 index 0000000000..d0ca03a51c --- /dev/null +++ b/src/components/button_unstyled.style.js @@ -0,0 +1,88 @@ +export default { + name: 'ButtonUnstyled', + selector: '.button-unstyled', + states: { + disabled: ':disabled', + toggled: '.toggled', + pressed: ':active', + hover: ':hover', + focused: ':focus-within' + }, + validInnerComponents: [ + 'Text', + 'Icon' + ], + defaultRules: [ + { + directives: { + background: '--fg', + shadow: [], + opacity: 0 + } + }, + { + component: 'Icon', + parent: { + component: 'ButtonUnstyled', + state: ['hover'] + }, + directives: { + textColor: '--parent--text' + } + }, + { + component: 'Icon', + parent: { + component: 'ButtonUnstyled', + state: ['toggled'] + }, + directives: { + textColor: '--parent--text' + } + }, + { + component: 'Text', + parent: { + component: 'ButtonUnstyled', + state: ['disabled'] + }, + directives: { + textOpacity: 0.25, + textOpacityMode: 'blend' + } + }, + { + component: 'Text', + parent: { + component: 'ButtonUnstyled', + state: ['disabled', 'hover'] + }, + directives: { + textOpacity: 0.25, + textOpacityMode: 'blend' + } + }, + { + component: 'Icon', + parent: { + component: 'ButtonUnstyled', + state: ['disabled'] + }, + directives: { + textOpacity: 0.25, + textOpacityMode: 'blend' + } + }, + { + component: 'Icon', + parent: { + component: 'ButtonUnstyled', + state: ['disabled', 'hover'] + }, + directives: { + textOpacity: 0.25, + textOpacityMode: 'blend' + } + } + ] +} diff --git a/src/components/chat_message/chat_message.vue b/src/components/chat_message/chat_message.vue index 381574c32e..166889d71d 100644 --- a/src/components/chat_message/chat_message.vue +++ b/src/components/chat_message/chat_message.vue @@ -53,7 +53,7 @@