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

style: Feedback component style refinement #3924

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
37 changes: 22 additions & 15 deletions editor.planx.uk/src/@planx/components/Feedback/Public/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHead
import type { PublicProps } from "@planx/components/shared/types";
import { useFormik } from "formik";
import React from "react";
import RichTextInput from "ui/editor/RichTextInput/RichTextInput";
import TerribleFace from "ui/images/feedback_filled-01.svg";
import PoorFace from "ui/images/feedback_filled-02.svg";
import NeutralFace from "ui/images/feedback_filled-03.svg";
import GoodFace from "ui/images/feedback_filled-04.svg";
import ExcellentFace from "ui/images/feedback_filled-05.svg";
import InputLabel from "ui/public/InputLabel";
import Input from "ui/shared/Input/Input";
import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml/ReactMarkdownOrHtml";

import { getPreviouslySubmittedData, makeData } from "../../shared/utils";
Expand Down Expand Up @@ -48,15 +48,17 @@ const FeedbackComponent = (props: PublicProps<Feedback>): FCReturn => {
id={"DESCRIPTION_TEXT"}
openLinksOnNewTab
/>
<Box pt={2} mb={3}>
<Box pt={1} mb={2}>
{props.ratingQuestion && (
<InputLabel
label={
<ReactMarkdownOrHtml
source={props.ratingQuestion}
id={"RATING_QUESTION"}
openLinksOnNewTab
/>
<Typography component="span" fontWeight="700">
<ReactMarkdownOrHtml
source={props.ratingQuestion}
id={"RATING_QUESTION"}
openLinksOnNewTab
/>
</Typography>
}
/>
)}
Expand All @@ -67,7 +69,7 @@ const FeedbackComponent = (props: PublicProps<Feedback>): FCReturn => {
onChange={handleFeedbackChange}
aria-label="feedback score"
>
<Grid container columnSpacing={15} component="fieldset">
<Grid container columnSpacing={2} sx={{ width: "100%" }} component="fieldset" direction={{ xs: "column", formWrap: "row" }}>
<FaceBox
value="1"
testId="feedback-button-terrible"
Expand Down Expand Up @@ -104,22 +106,27 @@ const FeedbackComponent = (props: PublicProps<Feedback>): FCReturn => {
{props.freeformQuestion && (
<InputLabel
label={
<ReactMarkdownOrHtml
source={props.freeformQuestion}
id={"RATING_QUESTION"}
openLinksOnNewTab
/>
<Typography component="span" fontWeight="700">
<ReactMarkdownOrHtml
source={props.freeformQuestion}
id={"RATING_QUESTION"}
openLinksOnNewTab
/>
</Typography>
}
/>
)}
<RichTextInput
<Input
type="text"
multiline
bordered
name="feedback"
value={formik.values.feedback}
placeholder="What did you think?"
onChange={formik.handleChange}
/>
</Box>
<Typography variant="caption">
<Typography variant="body2">
<ReactMarkdownOrHtml source={props?.disclaimer} id={"DISCLAIMER"} />
</Typography>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,32 @@ export const FaceBox = ({
value,
}: FaceBoxProps): ReactElement => {
return (
<Grid item xs={2} key={label}>
<Grid item xs={2.4} key={label}>
<ToggleButton
value={value}
data-testid={testId}
sx={{
px: 0,
px: 0, textTransform: "none", width: "100%",
"&[aria-pressed='true'] div": {
borderColor: (theme) => theme.palette.primary.dark,
background: (theme) => theme.palette.background.paper,
},
}}
disableRipple
>
<Box
sx={(theme) => ({
p: theme.spacing(2),
p: theme.spacing(2, 1),
border: `2px solid ${theme.palette.border.main} `,
width: "120px",
maxHeight: "120px",
display: "flex",
gap: theme.spacing(0.25),
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
width: "100%",
})}
>
<img src={icon} width={50} alt={altText} />
<img src={icon} width={32} alt={altText} />
<Typography variant="body2" pt={0.5}>
{label}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const freeformQuestionPlaceholder =
"Please tell us more about your experience.";
"Please tell us more about your experience";

export const ratingQuestionPlaceholder =
"How would you rate your experience with this service?";
Expand Down
1 change: 1 addition & 0 deletions editor.planx.uk/src/@planx/components/Feedback/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ToggleButtonGroup, {

export const StyledToggleButtonGroup = styled(ToggleButtonGroup)(
({ theme }) => ({
width: "100%",
[`& .${toggleButtonGroupClasses.grouped}`]: {
border: 0,
padding: 0,
Expand Down
Loading