feat: add icons to kmenu

This commit is contained in:
2023-08-02 13:11:17 +02:00
parent 32b6b04eb9
commit c7bcc0415a
13 changed files with 47 additions and 19 deletions

View File

@ -18,6 +18,7 @@ export const menus: Record<string, Menu> = {
{
title: "Create new article",
meta: "",
icon: "IconSquareRoundedPlus",
cb: (state) => {
state.menus["input_link"] = {
title: "Link:",
@ -48,6 +49,7 @@ export const menus: Record<string, Menu> = {
},
{
title: "Clear Cache",
icon: "IconRefresh",
cb: async (state) => {
state.activeState.value = "loading";
await fetch("/api/cache", {
@ -60,6 +62,7 @@ export const menus: Record<string, Menu> = {
{
title: "Add Movie infos",
meta: "",
icon: "IconReportSearch",
cb: async (state, context) => {
state.activeState.value = "loading";
const movie = context as Movie;

View File

@ -1,4 +1,7 @@
import { Signal } from "@preact/signals";
import * as icons from "@components/icons.tsx";
type IconKey = keyof typeof icons;
export type MenuState = {
activeMenu: Signal<string>;
@ -10,10 +13,10 @@ export type MenuState = {
export type MenuEntry = {
cb: (state: MenuState, context: unknown) => void;
icon?: IconKey;
meta?: string;
visible?: boolean | ((context: unknown) => boolean);
title: string;
icon?: string;
};
export type Menu = {