Skip to content

Commit

Permalink
Add Floatrange field
Browse files Browse the repository at this point in the history
  • Loading branch information
gabber235 committed Jul 20, 2024
1 parent 9092ffe commit b5c46a9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions documentation/src/components/EntryInspector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ function CustomFieldInspector({
/>
);
}
if (editor === "floatRange") {
return <FloatRangeField value={value} path={path} />;
}
return (
<div className="text-red-500 dark:text-red-400 text-xs">
Unknown custom editor: {editor}
Expand Down Expand Up @@ -698,3 +701,26 @@ function OptionalField({ value, field, path, pages }: OptionalFieldProps) {
</div>
);
}

type FloatRange = { start: number, end: number };

function FloatRangeField({ value, path }: { value: FloatRange, path: string }) {
const { start, end } = value;
return (
<div className="flex flex-col space-y-1 w-full">
<FieldHeader name={path} />
<div className="flex space-x-1 w-full">
<CordPropertyField
value={start}
display="Min"
color="text-red-500"
/>
<CordPropertyField
value={end}
display="Max"
color="text-green-500"
/>
</div>
</div>
);
}

0 comments on commit b5c46a9

Please sign in to comment.