1
0
Fork 0

Migrate Traefik Proxy dashboard UI to React

This commit is contained in:
Gina A. 2025-05-28 11:26:04 +02:00 committed by GitHub
parent 4790e4910f
commit f16fff577a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
324 changed files with 28303 additions and 19567 deletions

70
webui/src/layout/Page.tsx Normal file
View file

@ -0,0 +1,70 @@
import { Flex, globalCss, styled } from '@traefiklabs/faency'
import { ReactNode, useState } from 'react'
import { Helmet } from 'react-helmet-async'
import Container from './Container'
import { LAPTOP_BP, SideBarPanel, SideNav, TopNav } from './Navigation'
import { ToastPool } from 'components/ToastPool'
import { ToastProvider } from 'contexts/toasts'
export const LIGHT_PRIMARY_COLOR = '#217F97'
export const DARK_PRIMARY_COLOR = '#2AA2C1'
export const globalStyles = globalCss({
'.light': {
'--colors-primary': LIGHT_PRIMARY_COLOR,
},
'.dark': {
'--colors-primary': DARK_PRIMARY_COLOR,
},
body: {
backgroundColor: '$contentBg',
m: 0,
},
})
const PageContainer = styled(Container, {
py: '$5',
px: '$5',
m: 0,
'@media (max-width:1440px)': {
maxWidth: '100%',
},
})
export interface Props {
title?: string
children?: ReactNode
}
const Page = ({ children, title }: Props) => {
const [isSideBarPanelOpen, setIsSideBarPanelOpen] = useState(false)
return (
<ToastProvider>
{globalStyles()}
<Helmet>
<title>{title ? `${title} - ` : ''}Traefik Proxy</title>
</Helmet>
<Flex>
<SideBarPanel isOpen={isSideBarPanelOpen} onOpenChange={setIsSideBarPanelOpen} />
<SideNav isExpanded={isSideBarPanelOpen} onSidePanelToggle={() => setIsSideBarPanelOpen(true)} isResponsive />
<Flex
justify="center"
css={{ flex: 1, margin: 'auto', ml: 264, [`@media (max-width:${LAPTOP_BP}px)`]: { ml: 60 } }}
>
<PageContainer data-testid={`${title} page`} direction="column">
<TopNav />
{children}
</PageContainer>
</Flex>
</Flex>
<ToastPool />
</ToastProvider>
)
}
export default Page