Rename root folders

This commit is contained in:
2024-11-12 21:25:02 +01:00
parent f4c21edca0
commit fb1c9a499f
101 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,54 @@
import React from 'react';
import { Text, Center } from '@mantine/core';
import Editor from './Editor';
import MarkdownPreview from './MarkdownPreview';
import { getFileUrl } from '../../services/api';
import { isImageFile } from '../../utils/fileHelpers';
const ContentView = ({
activeTab,
selectedFile,
content,
handleContentChange,
handleSave,
handleFileSelect,
}) => {
if (!selectedFile) {
return (
<Center style={{ height: '100%' }}>
<Text size="xl" weight={500}>
No file selected.
</Text>
</Center>
);
}
if (isImageFile(selectedFile)) {
return (
<Center className="image-preview">
<img
src={getFileUrl(selectedFile)}
alt={selectedFile}
style={{
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'contain',
}}
/>
</Center>
);
}
return activeTab === 'source' ? (
<Editor
content={content}
handleContentChange={handleContentChange}
handleSave={handleSave}
selectedFile={selectedFile}
/>
) : (
<MarkdownPreview content={content} handleFileSelect={handleFileSelect} />
);
};
export default ContentView;