From 47a6fddc89b8f9110252c5e19a6e95152c367dbf Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Wed, 1 Feb 2023 15:33:27 -0600 Subject: [PATCH] feat: support for user specified icon --- src/custom-components/ReorderableList.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/custom-components/ReorderableList.tsx b/src/custom-components/ReorderableList.tsx index 21ab60f..93e3b97 100644 --- a/src/custom-components/ReorderableList.tsx +++ b/src/custom-components/ReorderableList.tsx @@ -1,6 +1,7 @@ import { Fragment, JSXElementConstructor, ReactElement, useState } from "react" import { FaEllipsisH } from "react-icons/fa" import { DialogButton, Field, Focusable, GamepadButton } from "../deck-components" +import { IconType } from "react-icons" export type ReorderableEntry = { label: string, @@ -12,7 +13,8 @@ type ListProps = { entries: ReorderableEntry[], onAction: (entryReference: ReorderableEntry) => void, onSave: (entries: ReorderableEntry[]) => void, - secondButton?: JSXElementConstructor<{entry:ReorderableEntry}> + secondButton?: JSXElementConstructor<{entry:ReorderableEntry}>, + primaryIcon?:IconType } /** @@ -61,7 +63,7 @@ export function ReorderableList(props: ListProps) { onClick={toggleReorderEnabled}> { entryList.map((entry: ReorderableEntry) => ( - + {props.secondButton ? : null} )) @@ -78,7 +80,8 @@ type ListEntryProps = { reorderEntryFunc: CallableFunction, reorderEnabled: boolean, onAction: (entryReference: ReorderableEntry) => void, - children:ReactElement|null + children:ReactElement|null, + primaryIcon: IconType } function ReorderableItem(props: ListEntryProps) { @@ -125,7 +128,7 @@ function ReorderableItem(props: ListEntryProps) { {props.children} props.onAction(props.entryData)} onOKButton={() => props.onAction(props.entryData)}> - +