Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Styled ServiceFlags #1887

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import makeStyles from "@mui/styles/makeStyles";
import { useFormik } from "formik";
import React from "react";
import ColorPicker from "ui/ColorPicker";
Expand All @@ -11,18 +11,13 @@ import InputRow from "ui/InputRow";
import InputRowItem from "ui/InputRowItem";
import InputRowLabel from "ui/InputRowLabel";

export const serviceFlagsStyles = makeStyles((theme) => ({
root: {
color: "currentColor",
},
swatch: {
width: 18,
height: 18,
display: "inline-block",
marginRight: theme.spacing(1),
verticalAlign: "middle",
marginTop: -3,
},
const Swatch = styled(Box)(({ theme }) => ({
width: 18,
height: 18,
display: "inline-block",
marginRight: theme.spacing(1),
verticalAlign: "middle",
marginTop: -3,
}));

export interface IServiceFlags {
Expand All @@ -40,7 +35,6 @@ export interface IServiceFlags {
}

const ServiceFlags: React.FC<IServiceFlags> = ({ flagSets }) => {
const classes = serviceFlagsStyles();
const formik = useFormik({
initialValues: {
flagSets,
Expand Down Expand Up @@ -168,10 +162,7 @@ const ServiceFlags: React.FC<IServiceFlags> = ({ flagSets }) => {
</InputRowItem>
) : (
<InputRowLabel>
<Box
className={classes.swatch}
bgcolor={flag.color}
/>
<Swatch bgcolor={flag.color} />
{flag.color}
</InputRowLabel>
)}
Expand Down