UNPKG

@kinvolk/headlamp-plugin

Version:

The needed infrastructure for building Headlamp plugins.

112 lines (111 loc) 4.21 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /* * Copyright 2025 The Kubernetes Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Box } from '@mui/system'; import { useMemo } from 'react'; import { createMuiTheme } from '../../../lib/themes'; export function ThemePreview({ theme, size = 50 }) { const muiTheme = useMemo(() => createMuiTheme(theme), [theme]); return (_jsxs(Box, { sx: { position: 'relative', width: size + 'px', height: size + 'px', background: muiTheme.palette.background.default, border: '1px solid', borderColor: muiTheme.palette.divider, borderRadius: '4px', overflow: 'hidden', }, children: [_jsx(Box // Sidebar , { // Sidebar sx: { height: '100%', width: '40%', background: muiTheme.palette.sidebar.background, position: 'absolute', top: 0, left: 0, borderRight: '1px solid', borderColor: muiTheme.palette.divider, } }), _jsx(Box // Sidebar Selected Item , { // Sidebar Selected Item sx: { position: 'absolute', top: '30%', left: '2%', width: '36%', background: muiTheme.palette.sidebar.selectedBackground, zIndex: 1, height: '5px', borderRadius: muiTheme.shape.borderRadius / 4 + 'px', } }), _jsx(Box // Card 1 , { // Card 1 sx: { position: 'absolute', top: '25%', left: '45%', width: '22%', height: '22%', background: muiTheme.palette.background.muted, zIndex: 2, borderRadius: muiTheme.shape.borderRadius / 4 + 'px', border: '1px solid', borderColor: muiTheme.palette.divider, } }), _jsx(Box // Card 2 , { // Card 2 sx: { position: 'absolute', top: '25%', left: '71%', width: '22%', height: '22%', background: muiTheme.palette.background.muted, zIndex: 2, borderRadius: muiTheme.shape.borderRadius / 4 + 'px', border: '1px solid', borderColor: muiTheme.palette.divider, } }), _jsx(Box // Sidebar Action Button , { // Sidebar Action Button sx: { position: 'absolute', bottom: '5%', left: '10%', width: '20%', height: '5%', background: muiTheme.palette.sidebar.actionBackground, zIndex: 1, } }), _jsx(Box // Navbar , { // Navbar sx: { position: 'absolute', width: '100%', borderBottom: '1px solid', borderColor: muiTheme.palette.divider, background: muiTheme.palette.navbar.background, height: '20%', } })] })); }