Skip to content

Commit

Permalink
feat: Environment dependant header chip styling (#3717)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianjon3s authored Sep 23, 2024
1 parent 28112a3 commit b6c2b72
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import Edit from "@mui/icons-material/Edit";
import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
import MenuOpenIcon from "@mui/icons-material/MenuOpen";
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
import OpenInNewOffIcon from "@mui/icons-material/OpenInNewOff";
import Person from "@mui/icons-material/Person";
import Visibility from "@mui/icons-material/Visibility";
import AppBar from "@mui/material/AppBar";
import Avatar from "@mui/material/Avatar";
import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
import { grey } from "@mui/material/colors";
import Container from "@mui/material/Container";
import IconButton from "@mui/material/IconButton";
Expand Down Expand Up @@ -172,6 +175,8 @@ const SkipLink = styled("a")(({ theme }) => ({

const ServiceTitleRoot = styled("span")(({ theme }) => ({
display: "flex",
alignItems: "center",
gap: theme.spacing(1),
flexGrow: 1,
flexShrink: 1,
lineHeight: LINE_HEIGHT_BASE,
Expand Down Expand Up @@ -428,9 +433,24 @@ const PublicToolbar: React.FC<{

const ServiceTitle: React.FC = () => {
const flowName = useStore((state) => state.flowName);
const route = useCurrentRoute();
const path = route.url.pathname.split("/").slice(-1)[0];

return (
<ServiceTitleRoot data-testid="service-title">
{(path === "preview" || path === "draft") && (
<Chip
label={capitalize(path)}
variant="notApplicableTag"
size="medium"
icon={
{
preview: <OpenInNewIcon fontSize="small" />,
draft: <OpenInNewOffIcon fontSize="small" />,
}[path]
}
/>
)}
<Typography component="span" variant="h4">
{flowName}
</Typography>
Expand Down

0 comments on commit b6c2b72

Please sign in to comment.