[nextgen/cardstack] use unicode instead of icons for arrows for light theme compat (visualrefresh)

This commit is contained in:
bignutty 2025-02-22 16:39:42 +01:00
parent c969754ca8
commit 7e96b1a413
2 changed files with 13 additions and 8 deletions

View file

@ -4,10 +4,14 @@ module.exports.BuiltInButtonTypes = Object.freeze({
PREVIOUS_PAGE: "previous" PREVIOUS_PAGE: "previous"
}) })
module.exports.DEFAULT_BUTTON_ICON_MAPPINGS = Object.freeze({ module.exports.DEFAULT_BUTTON_STYLES = Object.freeze({
[this.BuiltInButtonTypes.NEXT_PAGE]: "button_chevron_right", [this.BuiltInButtonTypes.NEXT_PAGE]: {
[this.BuiltInButtonTypes.PREVIOUS_PAGE]: "button_chevron_left" label: ""
}); },
[this.BuiltInButtonTypes.PREVIOUS_PAGE]: {
label: ""
}
})
module.exports.STACK_CACHE_KEYS = Object.freeze({ module.exports.STACK_CACHE_KEYS = Object.freeze({
RESULT_CARDS: 0 RESULT_CARDS: 0

View file

@ -11,12 +11,11 @@ const {Message} = require("detritus-client/lib/structures");
const {ComponentContext, Components, ComponentActionRow, ComponentButton} = require("detritus-client/lib/utils"); const {ComponentContext, Components, ComponentActionRow, ComponentButton} = require("detritus-client/lib/utils");
const { const {
DEFAULT_BUTTON_ICON_MAPPINGS,
STACK_CACHE_KEYS, STACK_CACHE_KEYS,
BuiltInButtonTypes, BuiltInButtonTypes,
ResolveCallbackTypes ResolveCallbackTypes
} = require("./constants"); } = require("./constants");
const {InteractiveComponentTypes} = require("#cardstack/constants"); const {InteractiveComponentTypes, DEFAULT_BUTTON_STYLES} = require("#cardstack/constants");
const {Xid} = require("#utils/hash"); const {Xid} = require("#utils/hash");
/** /**
@ -130,7 +129,7 @@ class DynamicCardStack {
console.error("Component Handler Exception:") console.error("Component Handler Exception:")
console.error(e) console.error(e)
}, },
onTimeout: (e)=> { onTimeout: ()=> {
this.kill(true); this.kill(true);
} }
}) })
@ -371,9 +370,11 @@ class DynamicCardStack {
customId: b, customId: b,
style: 2, style: 2,
disabled: this.activeCardStack.length === 1 || disabled, 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)); componentSlots[0].push(new ComponentButton(btn));
} }