Refactor BxIcon

This commit is contained in:
redphx
2024-05-03 17:27:13 +07:00
parent 3d3a013a5c
commit 3670946da4
10 changed files with 65 additions and 58 deletions

View File

@@ -1,6 +1,6 @@
import { MkbPreset } from "./mkb-preset";
import { GamepadKey, MkbPresetKey, GamepadStick, MouseMapTo } from "./definitions";
import { createButton, Icon, ButtonStyle, CE } from "@utils/html";
import { createButton, ButtonStyle, CE } from "@utils/html";
import { BxEvent } from "@utils/bx-event";
import { PrefKey, getPref } from "@utils/preferences";
import { Toast } from "@utils/toast";
@@ -12,6 +12,7 @@ import { showStreamSettings } from "@modules/stream/stream-ui";
import { STATES } from "@utils/global";
import { UserAgent } from "@utils/user-agent";
import { BxLogger } from "@utils/bx-logger";
import { BxIcon } from "@utils/bx-icon";
const LOG_TAG = 'MkbHandler';
@@ -381,7 +382,7 @@ export class MkbHandler {
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
createButton({
icon: Icon.MOUSE_SETTINGS,
icon: BxIcon.MOUSE_SETTINGS,
style: ButtonStyle.PRIMARY,
onClick: e => {
e.preventDefault();

View File

@@ -8,7 +8,7 @@ import { KeyHelper } from "./key-helper";
import { MkbPreset } from "./mkb-preset";
import { MkbHandler } from "./mkb-handler";
import { LocalDb } from "@utils/local-db";
import { Icon } from "@utils/html";
import { BxIcon } from "@utils/bx-icon";
import { SettingElement } from "@utils/settings";
import type { MkbPresetData, MkbStoredPresets } from "@/types/mkb";
@@ -340,7 +340,7 @@ export class MkbRemapper {
// Rename button
createButton({
title: t('rename'),
icon: Icon.CURSOR_TEXT,
icon: BxIcon.CURSOR_TEXT,
onClick: e => {
const preset = this.#getCurrentPreset();
@@ -357,7 +357,7 @@ export class MkbRemapper {
// New button
createButton({
icon: Icon.NEW,
icon: BxIcon.NEW,
title: t('new'),
onClick: e => {
let newName = promptNewName('');
@@ -375,7 +375,7 @@ export class MkbRemapper {
// Copy button
createButton({
icon: Icon.COPY,
icon: BxIcon.COPY,
title: t('copy'),
onClick: e => {
const preset = this.#getCurrentPreset();
@@ -395,7 +395,7 @@ export class MkbRemapper {
// Delete button
createButton({
icon: Icon.TRASH,
icon: BxIcon.TRASH,
style: ButtonStyle.DANGER,
title: t('delete'),
onClick: e => {