UNPKG

@kinvolk/headlamp-plugin

Version:

The needed infrastructure for building Headlamp plugins.

46 lines (45 loc) 2.51 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 { Icon } from '@iconify/react'; import ButtonBase from '@mui/material/ButtonBase'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import { useTheme } from '@mui/material/styles'; import Typography from '@mui/material/Typography'; export default function SquareButton(props) { const { icon, iconSize = 50, iconColor, label, primary = false, ...otherProps } = props; const theme = useTheme(); return (_jsx(ButtonBase, { focusRipple: true, ...otherProps, children: _jsx(Card, { variant: "outlined", sx: { width: 140, height: 140, paddingTop: '24px', backgroundColor: primary ? 'text.primary' : theme.palette.background.muted, }, children: _jsxs(CardContent, { sx: { textAlign: 'center', paddingTop: 0 }, children: [_jsx(Icon, { icon: icon, width: iconSize, height: iconSize, color: iconColor || (primary ? theme.palette.getContrastText(theme.palette.text.primary) : theme.palette.getContrastText(theme.palette.squareButton.background)) }), _jsx(Typography, { color: "textSecondary", gutterBottom: true, title: label, sx: { textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden', display: 'block', fontSize: '1rem', paddingTop: '8px', color: primary ? theme.palette.getContrastText(theme.palette.text.primary) : theme.palette.getContrastText(theme.palette.squareButton.background), }, children: label })] }) }) })); }