Implement image upload and viewer in v2

This commit is contained in:
LeonspaceX
2026-01-26 21:41:28 +08:00
parent 07bf09949f
commit 0cda40060e
9 changed files with 499 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
import { makeStyles, tokens, FluentProvider, webLightTheme, webDarkTheme, Toaster, useId } from '@fluentui/react-components';
import type { ReactNode } from 'react';
import { Outlet } from 'react-router-dom';
import Header from './components/Header';
import Sidebar from './components/Sidebar';
@@ -51,7 +52,7 @@ const useStyles = makeStyles({
}
});
const LayoutContent = ({ toasterId }: { toasterId: string }) => {
const LayoutContent = ({ toasterId, imageViewer }: { toasterId: string; imageViewer?: ReactNode }) => {
const styles = useStyles();
const { isDarkMode } = useLayout();
@@ -70,16 +71,17 @@ const LayoutContent = ({ toasterId }: { toasterId: string }) => {
</div>
<Footer />
<Toaster toasterId={toasterId} position="top-end" />
{imageViewer}
</div>
</FluentProvider>
);
};
export const MainLayout = () => {
export const MainLayout = ({ imageViewer }: { imageViewer?: ReactNode }) => {
const toasterId = useId('toaster');
return (
<LayoutProvider toasterId={toasterId}>
<LayoutContent toasterId={toasterId} />
<LayoutContent toasterId={toasterId} imageViewer={imageViewer} />
</LayoutProvider>
);
};