fix(editor): hide footer on SVG editor, contain SVG to viewport
Extract AppShell with useLocation to conditionally hide Footer on /svg-editor. Add max-height: 100% + width: auto to SVG canvas CSS so loaded SVGs fill available space without overflowing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ce84caea04
commit
9e60131de7
2 files changed
+22
-13
No files matched your search
+20
-13
@@ -1,4 +1,4 @@
|
|||||||
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
import { BrowserRouter, Routes, Route, useLocation } from 'react-router-dom'
|
||||||
import { ConfigProvider } from './providers/ConfigProvider'
|
import { ConfigProvider } from './providers/ConfigProvider'
|
||||||
import Footer from '@/components/brand/Footer'
|
import Footer from '@/components/brand/Footer'
|
||||||
import HomeRoute from './routes/HomeRoute'
|
import HomeRoute from './routes/HomeRoute'
|
||||||
@@ -7,22 +7,29 @@ import EditorRoute from './routes/EditorRoute'
|
|||||||
import SvgEditorRoute from './routes/SvgEditorRoute'
|
import SvgEditorRoute from './routes/SvgEditorRoute'
|
||||||
import NotFoundRoute from './routes/NotFoundRoute'
|
import NotFoundRoute from './routes/NotFoundRoute'
|
||||||
|
|
||||||
|
function AppShell() {
|
||||||
|
const hideFooter = useLocation().pathname === '/svg-editor'
|
||||||
|
return (
|
||||||
|
<div className="flex min-h-screen flex-col">
|
||||||
|
<main className="flex-1">
|
||||||
|
<Routes>
|
||||||
|
<Route path="/" element={<HomeRoute />} />
|
||||||
|
<Route path="/new" element={<NewReportRoute />} />
|
||||||
|
<Route path="/editor" element={<EditorRoute />} />
|
||||||
|
<Route path="/svg-editor" element={<SvgEditorRoute />} />
|
||||||
|
<Route path="*" element={<NotFoundRoute />} />
|
||||||
|
</Routes>
|
||||||
|
</main>
|
||||||
|
{!hideFooter && <Footer />}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<ConfigProvider>
|
<ConfigProvider>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<div className="flex min-h-screen flex-col">
|
<AppShell />
|
||||||
<main className="flex-1">
|
|
||||||
<Routes>
|
|
||||||
<Route path="/" element={<HomeRoute />} />
|
|
||||||
<Route path="/new" element={<NewReportRoute />} />
|
|
||||||
<Route path="/editor" element={<EditorRoute />} />
|
|
||||||
<Route path="/svg-editor" element={<SvgEditorRoute />} />
|
|
||||||
<Route path="*" element={<NotFoundRoute />} />
|
|
||||||
</Routes>
|
|
||||||
</main>
|
|
||||||
<Footer />
|
|
||||||
</div>
|
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
.svg-editor-canvas-inner svg {
|
.svg-editor-canvas-inner svg {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user