Skip to content

Commit

Permalink
chore: Rename QuestionHeader to CardHeader (#3176)
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored May 21, 2024
1 parent 9266bfb commit b207e63
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 58 deletions.
2 changes: 1 addition & 1 deletion editor.planx.uk/docs/adding-a-new-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Props = PublicProps<SetValue>;
function SetValueComponent(props: Props) {
return (
<Card handleSubmit={props.handleSubmit} isValid>
<QuestionHeader
<CardHeader
info={props.info}
policyRef={props.policyRef}
howMeasured={props.howMeasured}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/AddressInput/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import type { PublicProps } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down Expand Up @@ -43,7 +43,7 @@ export default function AddressInputComponent(props: Props): FCReturn {

return (
<Card handleSubmit={formik.handleSubmit}>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/Checklist/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { visuallyHidden } from "@mui/utils";
import type { Checklist, Group } from "@planx/components/Checklist/model";
import ImageButton from "@planx/components/shared/Buttons/ImageButton";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { getIn, useFormik } from "formik";
import React, { useState } from "react";
import InputLegend from "ui/editor/InputLegend";
Expand Down Expand Up @@ -132,7 +132,7 @@ const ChecklistComponent: React.FC<Props> = ({

return (
<Card handleSubmit={formik.handleSubmit} isValid>
<QuestionHeader
<CardHeader
title={text}
description={description}
info={info}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/ContactInput/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import type { PublicProps } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down Expand Up @@ -57,7 +57,7 @@ export default function ContactInputComponent(props: Props): FCReturn {

return (
<Card handleSubmit={formik.handleSubmit}>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Content/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { getContrastTextColor } from "styleUtils";
import { emptyContent } from "ui/editor/RichTextInput";
import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml";

import { HelpButton, Image } from "../shared/Preview/CardHeader";
import MoreInfo from "../shared/Preview/MoreInfo";
import MoreInfoSection from "../shared/Preview/MoreInfoSection";
import { HelpButton, Image } from "../shared/Preview/QuestionHeader";

export type Props = PublicProps<Content>;

Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/DateInput/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { visuallyHidden } from "@mui/utils";
import { DateInput, paddedDate } from "@planx/components/DateInput/model";
import { dateRangeSchema } from "@planx/components/DateInput/model";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { PublicProps } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down Expand Up @@ -44,7 +44,7 @@ const DateInputPublic: React.FC<Props> = (props) => {
.join(" ")}
>
<legend style={visuallyHidden}>{props.title}</legend>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { visuallyHidden } from "@mui/utils";
import { FileUploadSlot } from "@planx/components/FileUpload/Public";
import { PASSPORT_REQUESTED_FILES_KEY } from "@planx/components/FileUploadAndLabel/model";
import Card from "@planx/components/shared/Preview/Card";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import {
MapContainer,
MapFooter,
} from "@planx/components/shared/Preview/MapContainer";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import { PrivateFileUpload } from "@planx/components/shared/PrivateFileUpload/PrivateFileUpload";
import { squareMetresToHectares } from "@planx/components/shared/utils";
import type { PublicProps } from "@planx/components/ui";
Expand Down Expand Up @@ -227,7 +227,7 @@ export default function Component(props: Props) {
if (page === "draw") {
return (
<>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down Expand Up @@ -313,7 +313,7 @@ export default function Component(props: Props) {
} else if (page === "upload") {
return (
<>
<QuestionHeader
<CardHeader
title={props.titleForUploading}
description={props.descriptionForUploading}
info={props.info}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/FileUpload/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MoreInformation } from "@planx/components/shared";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { Store, useStore } from "pages/FlowEditor/lib/store";
import type { handleSubmit } from "pages/Preview/Node";
import React, { useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -116,7 +116,7 @@ const FileUpload: React.FC<Props> = (props) => {

return (
<Card isValid={true} handleSubmit={handleSubmit}>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml";
import { FileUploadSlot } from "../FileUpload/Public";
import { MoreInformation } from "../shared";
import Card from "../shared/Preview/Card";
import CardHeader, { Image } from "../shared/Preview/CardHeader";
import MoreInfo from "../shared/Preview/MoreInfo";
import MoreInfoSection from "../shared/Preview/MoreInfoSection";
import QuestionHeader, { Image } from "../shared/Preview/QuestionHeader";
import { Dropzone } from "../shared/PrivateFileUpload/Dropzone";
import { FileStatus } from "../shared/PrivateFileUpload/FileStatus";
import { UploadedFileCard } from "../shared/PrivateFileUpload/UploadedFileCard";
Expand Down Expand Up @@ -194,7 +194,7 @@ function Component(props: Props) {
}
>
<FullWidthWrapper>
<QuestionHeader {...props} />
<CardHeader {...props} />
<DropzoneContainer>
{!props.hideDropZone && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from "@mui/material/Link";
import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { squareMetresToHectares } from "@planx/components/shared/utils";
import { PublicProps } from "@planx/components/ui";
import area from "@turf/area";
Expand Down Expand Up @@ -188,7 +188,7 @@ function Component(props: Props) {
if (props.allowNewAddresses && page === "new-address") {
return (
<>
<QuestionHeader
<CardHeader
title={props.newAddressTitle}
description={props.newAddressDescription || ""}
/>
Expand Down Expand Up @@ -219,7 +219,7 @@ function Component(props: Props) {
// default to page === "os-address"
return (
<>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description || ""}
/>
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/NextSteps/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import React from "react";
import NextStepsList from "ui/public/NextStepsList";

import Card from "../shared/Preview/Card";
import QuestionHeader from "../shared/Preview/QuestionHeader";
import CardHeader from "../shared/Preview/CardHeader";
import { NextSteps } from "./model";

export type Props = PublicProps<NextSteps>;

const NextStepsComponent: React.FC<Props> = (props) => {
return (
<Card>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/Notice/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Typography from "@mui/material/Typography";
import type { Notice } from "@planx/components/Notice/model";
import Card from "@planx/components/shared/Preview/Card";
import { contentFlowSpacing } from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { PublicProps } from "@planx/components/ui";
import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider";
import React from "react";
Expand Down Expand Up @@ -94,7 +94,7 @@ const NoticeComponent: React.FC<Props> = (props) => {
return (
<Card handleSubmit={handleSubmit} isValid>
<>
<QuestionHeader
<CardHeader
info={props.info}
policyRef={props.policyRef}
howMeasured={props.howMeasured}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/NumberInput/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { PublicProps } from "@planx/components/ui";
import { useFormik } from "formik";
import isNil from "lodash/isNil";
Expand Down Expand Up @@ -65,7 +65,7 @@ export default function NumberInputComponent(props: Props): FCReturn {

return (
<Card handleSubmit={formik.handleSubmit} isValid>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description}
info={props.info}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
GISResponse,
} from "@opensystemslab/planx-core/types";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import type { PublicProps } from "@planx/components/ui";
import DelayedLoadingIndicator from "components/DelayedLoadingIndicator";
import capitalize from "lodash/capitalize";
Expand All @@ -15,6 +15,7 @@ import { handleSubmit } from "pages/Preview/Node";
import React from "react";
import useSWR, { Fetcher } from "swr";
import { FONT_WEIGHT_SEMI_BOLD } from "theme";
import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml";
import { stringify } from "wkt";

import { SiteAddress } from "../FindProperty/model";
Expand All @@ -27,7 +28,6 @@ import {
type IntersectingConstraints,
type PlanningConstraints,
} from "./model";
import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml";

type Props = PublicProps<PlanningConstraints>;

Expand Down Expand Up @@ -181,7 +181,7 @@ function Component(props: Props) {
/>
) : (
<Card handleSubmit={props.handleSubmit} isValid>
<QuestionHeader
<CardHeader
title={props.title}
description={props.description || ""}
/>
Expand All @@ -206,8 +206,14 @@ export type PlanningConstraintsContentProps = {
export function PlanningConstraintsContent(
props: PlanningConstraintsContentProps,
) {
const { title, description, constraints, metadata, refreshConstraints, disclaimer } =
props;
const {
title,
description,
constraints,
metadata,
refreshConstraints,
disclaimer,
} = props;
const error = constraints.error || undefined;
const showError = error || !Object.values(constraints)?.length;

Expand All @@ -221,7 +227,7 @@ export function PlanningConstraintsContent(

return (
<Card handleSubmit={props.handleSubmit}>
<QuestionHeader title={title} description={description} />
<CardHeader title={title} description={description} />
{showError && (
<ConstraintsFetchError
error={error}
Expand Down Expand Up @@ -283,7 +289,10 @@ const Disclaimer = (props: { text: string }) => (
<WarningContainer>
<ErrorOutline />
<Typography variant="body1" component="div" ml={2} mb={1}>
<ReactMarkdownOrHtml source={props.text || DEFAULT_PLANNING_CONDITIONS_DISCLAIMER} openLinksOnNewTab />
<ReactMarkdownOrHtml
source={props.text || DEFAULT_PLANNING_CONDITIONS_DISCLAIMER}
openLinksOnNewTab
/>
</Typography>
</WarningContainer>
);
Expand Down Expand Up @@ -324,7 +333,7 @@ interface ConstraintsGraphErrorProps {

const ConstraintsGraphError = (props: ConstraintsGraphErrorProps) => (
<Card handleSubmit={props.handleSubmit} isValid>
<QuestionHeader title={props.title} description={props.description || ""} />
<CardHeader title={props.title} description={props.description || ""} />
<ErrorSummaryContainer
role="status"
data-testid="error-summary-invalid-graph"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import { visuallyHidden } from "@mui/utils";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList";
import type { PublicProps } from "@planx/components/ui";
import { Feature } from "@turf/helpers";
Expand Down Expand Up @@ -130,7 +130,7 @@ export function Presentational(props: PresentationalProps) {

return (
<Card handleSubmit={handleSubmit}>
<QuestionHeader title={title} description={description} />
<CardHeader title={title} description={description} />
<MapContainer>
<p style={visuallyHidden}>
A static map centred on the property address, showing the title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import RadioGroup from "@mui/material/RadioGroup";
import { useTheme } from "@mui/material/styles";
import { visuallyHidden } from "@mui/utils";
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import BasicRadio from "@planx/components/shared/Radio/BasicRadio";
import DescriptionRadio from "@planx/components/shared/Radio/DescriptionRadio";
import ImageRadio from "@planx/components/shared/Radio/ImageRadio";
Expand Down Expand Up @@ -85,7 +85,7 @@ const Question: React.FC<IQuestion> = (props) => {

return (
<Card handleSubmit={formik.handleSubmit}>
<QuestionHeader
<CardHeader
title={props.text}
description={props.description}
info={props.info}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Card from "@planx/components/shared/Preview/Card";
import QuestionHeader from "@planx/components/shared/Preview/QuestionHeader";
import CardHeader from "@planx/components/shared/Preview/CardHeader";
import SummaryListsBySections from "@planx/components/shared/Preview/SummaryList";
import { Store } from "pages/FlowEditor/lib/store";
import { sortBreadcrumbs } from "pages/FlowEditor/lib/store/preview";
Expand Down Expand Up @@ -28,7 +28,7 @@ function Component(props: Props) {

return (
<Card isValid handleSubmit={props.handleSubmit}>
<QuestionHeader title={props.title} description={props.description} />
<CardHeader title={props.title} description={props.description} />
<SummaryListsBySections
breadcrumbs={sortedBreadcrumbs}
flow={props.flow}
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/Section/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SectionNode, SectionStatus } from "types";
import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml";

import Card from "../shared/Preview/Card";
import QuestionHeader from "../shared/Preview/QuestionHeader";
import CardHeader from "../shared/Preview/CardHeader";
import type { Section } from "./model";
import { computeSectionStatuses } from "./model";

Expand Down Expand Up @@ -78,7 +78,7 @@ export const Root = ({
...props
}: RootProps) => (
<Card isValid handleSubmit={handleSubmit}>
<QuestionHeader title={flowName} />
<CardHeader title={flowName} />
<Box>
<Typography variant="h3" component="h2" pb="0.25em">
Application incomplete.
Expand Down
Loading

0 comments on commit b207e63

Please sign in to comment.