fix export format state

This commit is contained in:
Philipinho
2024-07-22 13:02:13 +01:00
parent 4d2936627c
commit 78746938b7

View File

@ -56,7 +56,7 @@ export default function PageExportModal({
<div> <div>
<Text size="md">Format</Text> <Text size="md">Format</Text>
</div> </div>
<ExportFormatSelection onChange={handleChange} /> <ExportFormatSelection format={format} onChange={handleChange} />
</Group> </Group>
<Group justify="center" mt="md"> <Group justify="center" mt="md">
@ -72,16 +72,17 @@ export default function PageExportModal({
} }
interface ExportFormatSelection { interface ExportFormatSelection {
format: ExportFormat;
onChange: (value: string) => void; onChange: (value: string) => void;
} }
function ExportFormatSelection({ onChange }: ExportFormatSelection) { function ExportFormatSelection({ format, onChange }: ExportFormatSelection) {
return ( return (
<Select <Select
data={[ data={[
{ value: "markdown", label: "Markdown" }, { value: "markdown", label: "Markdown" },
{ value: "html", label: "HTML" }, { value: "html", label: "HTML" },
]} ]}
defaultValue={ExportFormat.Markdown} defaultValue={format}
onChange={onChange} onChange={onChange}
styles={{ wrapper: { maxWidth: 120 } }} styles={{ wrapper: { maxWidth: 120 } }}
comboboxProps={{ width: "120" }} comboboxProps={{ width: "120" }}