From 0df0093e6ba825a66048648588390a2233730c25 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Mon, 28 Aug 2023 23:47:20 -0400 Subject: [PATCH] Switch all other buttons to component --- renderer/src/styles/buttons.css | 5 ++++- renderer/src/styles/ui/keybind.css | 6 ++++++ renderer/src/ui/customcss/editor.jsx | 3 ++- renderer/src/ui/modals.js | 13 +++++++------ renderer/src/ui/settings/addonlist.jsx | 5 +++-- renderer/src/ui/settings/components/keybind.jsx | 5 +++-- renderer/src/ui/updater.jsx | 5 +++-- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/renderer/src/styles/buttons.css b/renderer/src/styles/buttons.css index 79b0eea0..8248a50e 100644 --- a/renderer/src/styles/buttons.css +++ b/renderer/src/styles/buttons.css @@ -96,6 +96,9 @@ .bd-button .bd-button-content { --button--underline-color: transparent; background-image: linear-gradient(0deg, transparent, transparent 1px, var(--button--underline-color) 0, var(--button--underline-color) 2px, transparent 0); + display: flex; + justify-content: center; + align-items: center; } .bd-button:disabled .bd-button-content { @@ -176,7 +179,7 @@ background: transparent; color: currentColor; border: 0; - padding: 0; + /* padding: 0; */ margin: 0 } diff --git a/renderer/src/styles/ui/keybind.css b/renderer/src/styles/ui/keybind.css index 0385cb31..89a630a5 100644 --- a/renderer/src/styles/ui/keybind.css +++ b/renderer/src/styles/ui/keybind.css @@ -35,9 +35,15 @@ top: 3px; display: flex; align-items: center; + gap: 5px; +} + +.bd-keybind-controls .bd-keybind-record { + padding: 4px 8px; } .bd-keybind-clear { + margin-left: 5px; background: none!important; opacity: 0.5; padding-right: 4px!important; diff --git a/renderer/src/ui/customcss/editor.jsx b/renderer/src/ui/customcss/editor.jsx index ffceeb8b..94de9b14 100644 --- a/renderer/src/ui/customcss/editor.jsx +++ b/renderer/src/ui/customcss/editor.jsx @@ -2,6 +2,7 @@ import React from "@modules/react"; import DiscordModules from "@modules/discordmodules"; import Settings from "@modules/settingsmanager"; +import Button from "../base/button"; import Checkbox from "./checkbox"; const {useState, useCallback, useEffect, forwardRef, useMemo, useImperativeHandle} = React; @@ -13,7 +14,7 @@ const languages = ["abap", "abc", "actionscript", "ada", "apache_conf", "asciido function makeButton(button, value) { return {props => { - return ; + return ; }} ; } diff --git a/renderer/src/ui/modals.js b/renderer/src/ui/modals.js index 5e5426a2..8c6c3891 100644 --- a/renderer/src/ui/modals.js +++ b/renderer/src/ui/modals.js @@ -8,7 +8,7 @@ import ReactDOM from "@modules/reactdom"; import Strings from "@modules/strings"; import Settings from "@modules/settingsmanager"; import Events from "@modules/emitter"; -import DiscordModules from "@modules/discordmodules"; +// import DiscordModules from "@modules/discordmodules"; import WebpackModules from "@modules/webpackmodules"; import DOMManager from "@modules/dommanager"; @@ -16,12 +16,12 @@ import AddonErrorModal from "./modals/addonerrormodal"; import ErrorBoundary from "./errorboundary"; import TextElement from "./base/text"; import ModalRoot from "./modals/root"; -import ModalHeader from "./modals/header"; -import ModalContent from "./modals/content"; -import ModalFooter from "./modals/footer"; +// import ModalHeader from "./modals/header"; +// import ModalContent from "./modals/content"; +// import ModalFooter from "./modals/footer"; import ConfirmationModal from "./modals/confirmation"; -import Button from "./base/button"; +// import Button from "./base/button"; import CustomMarkdown from "./base/markdown"; import ChangelogModal from "./modals/changelog"; import ModalStack, {generateKey} from "./modals/stack"; @@ -270,7 +270,7 @@ export default class Modals { confirmText: Strings.Modals.done }; - return this.ModalActions.openModal(props => { + return this.openModal(props => { return React.createElement(ErrorBoundary, null, React.createElement(ConfirmationModal, Object.assign(options, props), child)); }); } @@ -285,6 +285,7 @@ export default class Modals { } static openModal(render, options = {}) { + if (typeof(this.ModalActions.openModal) === "function") return this.ModalActions.openModal(render); if (!this.hasInitialized) this.makeStack(); options.modalKey = generateKey(options.modalKey); Events.emit("open-modal", render, options); diff --git a/renderer/src/ui/settings/addonlist.jsx b/renderer/src/ui/settings/addonlist.jsx index 8e61f093..d209ae71 100644 --- a/renderer/src/ui/settings/addonlist.jsx +++ b/renderer/src/ui/settings/addonlist.jsx @@ -4,6 +4,7 @@ import Events from "@modules/emitter"; import DataStore from "@modules/datastore"; import DiscordModules from "@modules/discordmodules"; +import Button from "../base/button"; import SettingsTitle from "./title"; import AddonCard from "./addoncard"; import Dropdown from "./components/dropdown"; @@ -45,14 +46,14 @@ function openFolder(folder) { function blankslate(type, onClick) { const message = Strings.Addons.blankSlateMessage.format({link: `https://betterdiscord.app/${type}s`, type}).toString(); return - + ; } function makeControlButton(title, children, action, selected = false) { return {(props) => { - return ; + return ; }} ; } diff --git a/renderer/src/ui/settings/components/keybind.jsx b/renderer/src/ui/settings/components/keybind.jsx index 992cf1cb..f6a04602 100644 --- a/renderer/src/ui/settings/components/keybind.jsx +++ b/renderer/src/ui/settings/components/keybind.jsx @@ -1,5 +1,6 @@ import React from "@modules/react"; +import Button from "../../base/button"; import Keyboard from "@ui/icons/keyboard"; import Close from "@ui/icons/close"; @@ -45,8 +46,8 @@ export default function Keybind({value: initialValue, onChange, max = 2, clearab return
- - {clearable && } + + {clearable && }
; } \ No newline at end of file diff --git a/renderer/src/ui/updater.jsx b/renderer/src/ui/updater.jsx index b274b738..dc81d024 100644 --- a/renderer/src/ui/updater.jsx +++ b/renderer/src/ui/updater.jsx @@ -4,6 +4,7 @@ import React from "@modules/react"; import Strings from "@modules/strings"; import Events from "@modules/emitter"; +import Button from "./base/button"; import Drawer from "./settings/drawer"; import SettingItem from "./settings/components/item"; import SettingsTitle from "./settings/title"; @@ -17,7 +18,7 @@ function CoreUpdaterPanel({hasUpdate, remoteVersion, update}) { return {!hasUpdate &&
} - {hasUpdate && } + {hasUpdate && }
; } @@ -37,7 +38,7 @@ function AddonUpdaterPanel({pending, type, updater, update, updateAll}) { const info = updater.cache[f]; const addon = updater.manager.addonList.find(a => a.filename === f); return - + ; })} ;