Codemirror cleanup

This commit is contained in:
Dane Everitt 2020-09-15 20:53:23 -07:00
parent 80e08572d6
commit 3af9e92603
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 157 additions and 123 deletions

View file

@ -82,11 +82,6 @@ export default () => {
);
}
const actualModes: React.ReactChild[] = [];
for (let i = 0; i < modes.length; i++) {
actualModes.push(<option key={modes[i].mime} value={modes[i].mime}>{modes[i].name}</option>);
}
return (
<PageContentBlock>
<FlashMessageRender byKey={'files:view'} css={tw`mb-4`}/>
@ -127,7 +122,11 @@ export default () => {
<div css={tw`flex justify-end mt-4`}>
<div css={tw`flex-1 sm:flex-none rounded bg-neutral-900 mr-4`}>
<Select value={mode} onChange={e => setMode(e.currentTarget.value)}>
{actualModes}
{modes.map(mode => (
<option key={`${mode.name}_${mode.mime}`} value={mode.mime}>
{mode.name}
</option>
))}
</Select>
</div>
{action === 'edit' ?