Path: blob/trunk/javascript/grid-ui/src/components/TopBar/TopBar.tsx
4505 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617import MuiAppBar from '@mui/material/AppBar'18import Box from '@mui/material/Box'19import CssBaseline from '@mui/material/CssBaseline'20import IconButton from '@mui/material/IconButton'21import { styled } from '@mui/material/styles'22import Toolbar from '@mui/material/Toolbar'23import Typography from '@mui/material/Typography'24import { ChevronLeft as ChevronLeftIcon } from '@mui/icons-material'25import { Menu as MenuIcon } from '@mui/icons-material'26import { Help as HelpIcon } from '@mui/icons-material'27import React from 'react'28import seleniumGridLogo from '../../assets/selenium-grid-logo.svg'29import { ThemeToggle } from '../ThemeToggle/ThemeToggle'3031const AppBar = styled(MuiAppBar)(({ theme }) => ({32zIndex: theme.zIndex.drawer + 1,33transition: theme.transitions.create(['width', 'margin'], {34easing: theme.transitions.easing.sharp,35duration: theme.transitions.duration.leavingScreen36})37}))3839function TopBar (props): JSX.Element {40const { subheader, error, drawerOpen, toggleDrawer } = props4142return (43<Box display="flex">44<CssBaseline/>45<AppBar position="fixed">46<Toolbar sx={{ paddingRight: '24px' }}>47{!error && (48<IconButton49edge="start"50color="inherit"51aria-label={drawerOpen ? 'close drawer' : 'open drawer'}52onClick={toggleDrawer}53size="large"54sx={{ marginRight: '36px' }}55>56{drawerOpen ? (<ChevronLeftIcon/>) : (<MenuIcon/>)}57</IconButton>58)}59<IconButton60edge="start"61color="inherit"62aria-label="help"63href="#help"64sx={{ marginRight: '36px', display: !error ? 'none' : '' }}65size="large"66>67<HelpIcon/>68</IconButton>69<Box70sx={{71display: 'flex',72width: 'calc(100%)',73alignItems: 'center',74justifyContent: 'center'75}}76>77<Box78component="img"79src={seleniumGridLogo}80alt="Selenium Grid Logo"81sx={{82width: 52,83height: 52,84marginRight: '10px'85}}86/>87<Box88alignItems="center"89display="flex"90flexDirection="column"91>92<Typography93component="h1"94variant="h4"95noWrap96sx={{ color: (theme) => theme.palette.mode === 'dark' ? 'primary.main' : 'inherit' }}97>98Selenium Grid99</Typography>100<Typography variant="body2" sx={{ color: (theme) => theme.palette.mode === 'dark' ? 'primary.main' : 'inherit' }}>101{subheader}102</Typography>103</Box>104</Box>105<ThemeToggle />106</Toolbar>107</AppBar>108</Box>109)110}111112export default TopBar113114115