Make CreaturePartEditor generic.

pull/230/head
Atul Varma 2021-09-28 10:55:45 -04:00
rodzic 31bc73a7b1
commit 450c930241
1 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -288,11 +288,15 @@ const AttachmentIndicesWidget: React.FC<{
); );
}; };
const CreaturePartEditor: React.FC<{ function CreaturePartEditor<T extends CreatureSymbol>({
creature: CreatureSymbol; creature,
onChange: (symbol: CreatureSymbol) => void; onChange,
idPrefix,
}: {
creature: T;
onChange: (symbol: T) => void;
idPrefix: string; idPrefix: string;
}> = ({ creature, onChange, idPrefix }) => { }): JSX.Element {
const specs = creature.data.specs || {}; const specs = creature.data.specs || {};
const getAttachmentIndex = (attachment: AttachedCreatureSymbol) => { const getAttachmentIndex = (attachment: AttachedCreatureSymbol) => {
const index = creature.attachments.indexOf(attachment); const index = creature.attachments.indexOf(attachment);
@ -410,7 +414,7 @@ const CreaturePartEditor: React.FC<{
})} })}
</> </>
); );
}; }
const CreatureEditorWidget: React.FC<{ const CreatureEditorWidget: React.FC<{
creature: CreatureSymbol; creature: CreatureSymbol;