-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
196 additions
and
26 deletions.
There are no files selected for viewing
114 changes: 105 additions & 9 deletions
114
editor.planx.uk/src/pages/FlowEditor/components/Settings/DesignSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,119 @@ | ||
import Box from "@mui/material/Box"; | ||
import Button from "@mui/material/Button"; | ||
import Link from "@mui/material/Link"; | ||
import Typography from "@mui/material/Typography"; | ||
import { useFormik } from "formik"; | ||
import React from "react"; | ||
import { FeaturePlaceholder } from "ui/FeaturePlaceholder"; | ||
import ColorPicker from "ui/ColorPicker"; | ||
import EditorRow from "ui/EditorRow"; | ||
import InputCaption from "ui/InputCaption"; | ||
import InputGroup from "ui/InputGroup"; | ||
import InputLegend from "ui/InputLegend"; | ||
import InputRow from "ui/InputRow"; | ||
import InputRowItem from "ui/InputRowItem"; | ||
import InputRowLabel from "ui/InputRowLabel"; | ||
import PublicFileUploadButton from "ui/PublicFileUploadButton"; | ||
|
||
const DesignSettings: React.FC = () => { | ||
const formik = useFormik<{ bgColor: string }>({ | ||
initialValues: { | ||
bgColor: "#000", | ||
}, | ||
onSubmit: () => {}, | ||
validate: () => {}, | ||
}); | ||
|
||
return ( | ||
<> | ||
<Box> | ||
<form onSubmit={formik.handleSubmit}> | ||
<EditorRow> | ||
<Typography variant="h2" component="h3" gutterBottom> | ||
Design | ||
</Typography> | ||
<Typography variant="body1"> | ||
How your service appears to public users | ||
</Typography> | ||
<Box py={5}> | ||
<FeaturePlaceholder title="Feature in development" /> | ||
</Box> | ||
</Box> | ||
</> | ||
</EditorRow> | ||
<EditorRow> | ||
<InputGroup flowSpacing> | ||
<InputLegend>Theme colour</InputLegend> | ||
<InputCaption> | ||
Set the theme colour. The theme colour should be a dark colour that | ||
contrasts with white ("#ffffff"). | ||
</InputCaption> | ||
<Link variant="body2" href="https://www.planx.uk"> | ||
See our guide for setting theme colours | ||
</Link> | ||
<InputRow> | ||
<InputRowItem> | ||
<ColorPicker | ||
color={formik.values.bgColor} | ||
onChange={(color) => formik.setFieldValue("bgColor", color)} | ||
label="Theme colour" | ||
/> | ||
</InputRowItem> | ||
</InputRow> | ||
</InputGroup> | ||
</EditorRow> | ||
|
||
<EditorRow> | ||
<InputGroup flowSpacing> | ||
<InputLegend>Logo</InputLegend> | ||
<InputCaption> | ||
Set the logo to be used in the header of the service. | ||
</InputCaption> | ||
<Link variant="body2" href="https://www.planx.uk"> | ||
See our guide for logos | ||
</Link> | ||
<InputRow> | ||
<InputRowLabel>Logo:</InputRowLabel> | ||
<InputRowItem width={50}> | ||
<PublicFileUploadButton /> | ||
</InputRowItem> | ||
<Typography | ||
color="text.secondary" | ||
variant="body2" | ||
pl={2} | ||
alignSelf="center" | ||
> | ||
.png or .svg | ||
</Typography> | ||
</InputRow> | ||
</InputGroup> | ||
</EditorRow> | ||
|
||
<EditorRow> | ||
<InputGroup flowSpacing> | ||
<InputLegend>Favicon</InputLegend> | ||
<InputCaption> | ||
Set the favicon to be used in the browser tab. The favicon should be | ||
32x32px and in .ico or .png format. | ||
</InputCaption> | ||
<Link variant="body2" href="https://www.planx.uk"> | ||
See our guide for favicons | ||
</Link> | ||
<InputRow> | ||
<InputRowLabel>Favicon:</InputRowLabel> | ||
<InputRowItem width={50}> | ||
<PublicFileUploadButton /> | ||
</InputRowItem> | ||
<Typography | ||
color="text.secondary" | ||
variant="body2" | ||
pl={2} | ||
alignSelf="center" | ||
> | ||
.ico or .png | ||
</Typography> | ||
</InputRow> | ||
</InputGroup> | ||
</EditorRow> | ||
|
||
<EditorRow> | ||
<Button type="submit" variant="contained" color="primary"> | ||
Update design settings | ||
</Button> | ||
</EditorRow> | ||
</form> | ||
); | ||
}; | ||
|
||
export default DesignSettings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Box from "@mui/material/Box"; | ||
import { styled } from "@mui/material/styles"; | ||
import { contentFlowSpacing } from "@planx/components/shared/Preview/Card"; | ||
import React, { ReactNode } from "react"; | ||
|
||
const Root = styled(Box)(({ theme }) => ({ | ||
display: "block", | ||
width: "100%", | ||
padding: theme.spacing(3, 0), | ||
"&:first-of-type": { | ||
paddingTop: 0, | ||
}, | ||
"& + &": { | ||
borderTop: "1px solid", | ||
borderColor: theme.palette.border.main, | ||
}, | ||
"& > * + *": { | ||
...contentFlowSpacing(theme), | ||
}, | ||
})); | ||
|
||
export default function InputRow({ children }: { children: ReactNode }) { | ||
return <Root>{children}</Root>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { styled } from "@mui/material/styles"; | ||
import Typography from "@mui/material/Typography"; | ||
import React, { ReactNode } from "react"; | ||
|
||
const Caption = styled(Typography)(({ theme }) => ({ | ||
width: "100%", | ||
textAlign: "left", | ||
color: theme.palette.text.secondary, | ||
})) as typeof Typography; | ||
|
||
export default function InputCaption({ children }: { children: ReactNode }) { | ||
return ( | ||
<Caption variant="body2" component="caption"> | ||
{children} | ||
</Caption> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { styled } from "@mui/material/styles"; | ||
import Typography from "@mui/material/Typography"; | ||
import React, { ReactNode } from "react"; | ||
|
||
const Legend = styled(Typography)(() => ({ | ||
display: "block", | ||
width: "100%", | ||
})) as typeof Typography; | ||
|
||
export default function InputLegend({ children }: { children: ReactNode }) { | ||
return ( | ||
<Legend variant="h3" component="legend"> | ||
{children} | ||
</Legend> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import Box from "@mui/material/Box"; | ||
import { styled } from "@mui/material/styles"; | ||
import Typography from "@mui/material/Typography"; | ||
import React, { ReactNode } from "react"; | ||
|
||
const Root = styled(Box)(({ theme }) => ({ | ||
const Label = styled(Typography)(({ theme }) => ({ | ||
flexShrink: 1, | ||
flexGrow: 0, | ||
paddingRight: theme.spacing(2), | ||
alignSelf: "center", | ||
"&:not(:first-child)": { | ||
paddingLeft: theme.spacing(2), | ||
}, | ||
})); | ||
})) as typeof Typography; | ||
|
||
export default function InputRowLabel({ children }: { children: ReactNode }) { | ||
return <Root>{children}</Root>; | ||
return ( | ||
<Label variant="body2" component="label"> | ||
{children} | ||
</Label> | ||
); | ||
} |