Make CreaturePartEditor generic.
rodzic
31bc73a7b1
commit
450c930241
|
@ -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;
|
||||||
|
|
Ładowanie…
Reference in New Issue