-
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.
feat: Wire up design settings (theme colour & logo) (#2660)
- Loading branch information
1 parent
c283603
commit 6fe38c4
Showing
7 changed files
with
467 additions
and
285 deletions.
There are no files selected for viewing
285 changes: 0 additions & 285 deletions
285
editor.planx.uk/src/pages/FlowEditor/components/Settings/DesignSettings.tsx
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
editor.planx.uk/src/pages/FlowEditor/components/Settings/DesignSettings/ButtonForm.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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Button from "@mui/material/Button"; | ||
import Link from "@mui/material/Link"; | ||
import { useFormik } from "formik"; | ||
import React from "react"; | ||
import ColorPicker from "ui/editor/ColorPicker"; | ||
import InputDescription from "ui/editor/InputDescription"; | ||
import InputRow from "ui/shared/InputRow"; | ||
import InputRowItem from "ui/shared/InputRowItem"; | ||
|
||
import { DesignPreview, EXAMPLE_COLOUR, SettingsForm } from "."; | ||
|
||
export const ButtonForm: React.FC = () => { | ||
const formik = useFormik<{ | ||
buttonColor: string; | ||
}>({ | ||
initialValues: { | ||
buttonColor: EXAMPLE_COLOUR, | ||
}, | ||
onSubmit: () => {}, | ||
validate: () => {}, | ||
}); | ||
|
||
return ( | ||
<SettingsForm | ||
formik={formik} | ||
legend="Button colour" | ||
description={ | ||
<> | ||
<InputDescription> | ||
The button background colour should be either a dark or light | ||
colour. The text will be programmatically selected to contrast with | ||
the selected colour (being either black or white). | ||
</InputDescription> | ||
<InputDescription> | ||
<Link href="https://www.planx.uk"> | ||
See our guide for setting button colours | ||
</Link> | ||
</InputDescription> | ||
</> | ||
} | ||
input={ | ||
<InputRow> | ||
<InputRowItem> | ||
<ColorPicker | ||
color={formik.values.buttonColor} | ||
onChange={(color) => formik.setFieldValue("buttonColor", color)} | ||
label="Button colour" | ||
/> | ||
</InputRowItem> | ||
</InputRow> | ||
} | ||
preview={ | ||
<DesignPreview bgcolor="white"> | ||
<Button variant="contained" sx={{ backgroundColor: EXAMPLE_COLOUR }}> | ||
Example primary button | ||
</Button> | ||
</DesignPreview> | ||
} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.