From 7e96b1a41375a69afa5c71840482a5ee0facbf5d Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Sat, 22 Feb 2025 16:39:42 +0100 Subject: [PATCH] [nextgen/cardstack] use unicode instead of icons for arrows for light theme compat (visualrefresh) --- labscore/cardstack/constants.js | 12 ++++++++---- labscore/cardstack/stack.js | 9 +++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/labscore/cardstack/constants.js b/labscore/cardstack/constants.js index b003302..e7b896b 100644 --- a/labscore/cardstack/constants.js +++ b/labscore/cardstack/constants.js @@ -4,10 +4,14 @@ module.exports.BuiltInButtonTypes = Object.freeze({ PREVIOUS_PAGE: "previous" }) -module.exports.DEFAULT_BUTTON_ICON_MAPPINGS = Object.freeze({ - [this.BuiltInButtonTypes.NEXT_PAGE]: "button_chevron_right", - [this.BuiltInButtonTypes.PREVIOUS_PAGE]: "button_chevron_left" -}); +module.exports.DEFAULT_BUTTON_STYLES = Object.freeze({ + [this.BuiltInButtonTypes.NEXT_PAGE]: { + label: "❯" + }, + [this.BuiltInButtonTypes.PREVIOUS_PAGE]: { + label: "❮" + } +}) module.exports.STACK_CACHE_KEYS = Object.freeze({ RESULT_CARDS: 0 diff --git a/labscore/cardstack/stack.js b/labscore/cardstack/stack.js index 5a3a825..f3f8367 100644 --- a/labscore/cardstack/stack.js +++ b/labscore/cardstack/stack.js @@ -11,12 +11,11 @@ const {Message} = require("detritus-client/lib/structures"); const {ComponentContext, Components, ComponentActionRow, ComponentButton} = require("detritus-client/lib/utils"); const { - DEFAULT_BUTTON_ICON_MAPPINGS, STACK_CACHE_KEYS, BuiltInButtonTypes, ResolveCallbackTypes } = require("./constants"); -const {InteractiveComponentTypes} = require("#cardstack/constants"); +const {InteractiveComponentTypes, DEFAULT_BUTTON_STYLES} = require("#cardstack/constants"); const {Xid} = require("#utils/hash"); /** @@ -130,7 +129,7 @@ class DynamicCardStack { console.error("Component Handler Exception:") console.error(e) }, - onTimeout: (e)=> { + onTimeout: ()=> { this.kill(true); } }) @@ -371,9 +370,11 @@ class DynamicCardStack { customId: b, style: 2, disabled: this.activeCardStack.length === 1 || disabled, - emoji: iconAsEmojiObject(DEFAULT_BUTTON_ICON_MAPPINGS[b]) } + if(DEFAULT_BUTTON_STYLES[b].icon) btn.emoji = iconAsEmojiObject(DEFAULT_BUTTON_STYLES[b].icon); + if(DEFAULT_BUTTON_STYLES[b].label) btn.label = DEFAULT_BUTTON_STYLES[b].label; + componentSlots[0].push(new ComponentButton(btn)); }