Path: blob/trunk/javascript/grid-ui/src/components/TopBar/TopBar.tsx
2887 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'2930const AppBar = styled(MuiAppBar)(({ theme }) => ({31zIndex: theme.zIndex.drawer + 1,32transition: theme.transitions.create(['width', 'margin'], {33easing: theme.transitions.easing.sharp,34duration: theme.transitions.duration.leavingScreen35})36}))3738function TopBar (props): JSX.Element {39const { subheader, error, drawerOpen, toggleDrawer } = props4041return (42<Box display="flex">43<CssBaseline/>44<AppBar position="fixed">45<Toolbar sx={{ paddingRight: '24px' }}>46{!error && (47<IconButton48edge="start"49color="inherit"50aria-label={drawerOpen ? 'close drawer' : 'open drawer'}51onClick={toggleDrawer}52size="large"53sx={{ marginRight: '36px' }}54>55{drawerOpen ? (<ChevronLeftIcon/>) : (<MenuIcon/>)}56</IconButton>57)}58<IconButton59edge="start"60color="inherit"61aria-label="help"62href="#help"63sx={{ marginRight: '36px', display: !error ? 'none' : '' }}64size="large"65>66<HelpIcon/>67</IconButton>68<Box69sx={{70display: 'flex',71width: 'calc(100%)',72alignItems: 'center',73justifyContent: 'center'74}}75>76<Box77component="img"78src={seleniumGridLogo}79alt="Selenium Grid Logo"80sx={{81width: 52,82height: 52,83marginRight: '10px'84}}85/>86<Box87alignItems="center"88display="flex"89flexDirection="column"90>91<Typography92component="h1"93variant="h4"94noWrap95>96Selenium Grid97</Typography>98<Typography variant="body2">99{subheader}100</Typography>101</Box>102</Box>103</Toolbar>104</AppBar>105</Box>106)107}108109export default TopBar110111112