refactor: super export modal

This commit is contained in:
Aman Harwara
2024-01-27 16:17:01 +05:30
parent c858e516bb
commit 70ec1f1b54

View File

@@ -2,7 +2,6 @@ import { PrefKey, PrefValue, SNNote } from '@standardnotes/snjs'
import { useApplication } from '../ApplicationProvider' import { useApplication } from '../ApplicationProvider'
import Modal from '../Modal/Modal' import Modal from '../Modal/Modal'
import usePreference from '@/Hooks/usePreference' import usePreference from '@/Hooks/usePreference'
import RadioButtonGroup from '../RadioButtonGroup/RadioButtonGroup'
import { useEffect } from 'react' import { useEffect } from 'react'
import Switch from '../Switch/Switch' import Switch from '../Switch/Switch'
import { noteHasEmbeddedFiles } from '@/Utils/NoteExportUtils' import { noteHasEmbeddedFiles } from '@/Utils/NoteExportUtils'
@@ -62,7 +61,7 @@ const SuperExportModal = ({ notes, exportNotes, close }: Props) => {
]} ]}
> >
<div className="mb-2"> <div className="mb-2">
<div className="mb-2 flex items-center justify-between"> <div className="mb-2 flex flex-wrap items-center justify-between gap-2">
<div className="text-base">Choose export format {notes.length > 1 ? 'for Super notes' : ''}</div> <div className="text-base">Choose export format {notes.length > 1 ? 'for Super notes' : ''}</div>
<Dropdown <Dropdown
label="Export format" label="Export format"
@@ -79,6 +78,9 @@ const SuperExportModal = ({ notes, exportNotes, close }: Props) => {
value as PrefValue[PrefKey.SuperNoteExportFormat], value as PrefValue[PrefKey.SuperNoteExportFormat],
) )
}} }}
classNameOverride={{
wrapper: 'w-full md:w-fit',
}}
/> />
</div> </div>
{superNoteExportFormat === 'md' && ( {superNoteExportFormat === 'md' && (
@@ -89,7 +91,7 @@ const SuperExportModal = ({ notes, exportNotes, close }: Props) => {
)} )}
</div> </div>
{superNoteExportFormat === 'pdf' && ( {superNoteExportFormat === 'pdf' && (
<div className="mt-4 flex items-center justify-between"> <div className="mt-4 flex flex-wrap items-center justify-between gap-2">
<div className="text-base">Page size</div> <div className="text-base">Page size</div>
<Dropdown <Dropdown
label="Page size" label="Page size"
@@ -112,6 +114,9 @@ const SuperExportModal = ({ notes, exportNotes, close }: Props) => {
value as PrefValue[PrefKey.SuperNoteExportPDFPageSize], value as PrefValue[PrefKey.SuperNoteExportPDFPageSize],
) )
}} }}
classNameOverride={{
wrapper: 'w-full md:w-fit',
}}
/> />
</div> </div>
)} )}
@@ -132,9 +137,10 @@ const SuperExportModal = ({ notes, exportNotes, close }: Props) => {
</div> </div>
)} )}
{canShowEmbeddedFileOptions && someNotesHaveEmbeddedFiles && ( {canShowEmbeddedFileOptions && someNotesHaveEmbeddedFiles && (
<div className="mb-2 mt-4"> <div className="mb-2 mt-4 flex flex-wrap items-center justify-between gap-2">
<div className="mb-1">How do you want embedded files to be handled?</div> <div className="text-base">Embedded files</div>
<RadioButtonGroup <Dropdown
label="Embedded files"
items={[ items={[
{ label: 'Inline', value: 'inline' }, { label: 'Inline', value: 'inline' },
{ label: 'Export separately', value: 'separate' }, { label: 'Export separately', value: 'separate' },