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

fix: Drop redundant (and error-throwing) :first-child selector #2325

Merged
merged 2 commits into from
Oct 18, 2023
Merged
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
6 changes: 1 addition & 5 deletions editor.planx.uk/src/@planx/components/NextSteps/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PublicProps } from "@planx/components/ui";

import React from "react";
import NextStepsList from "ui/NextStepsList";

Expand All @@ -19,10 +18,7 @@ const NextStepsComponent: React.FC<Props> = (props) => {
policyRef={props.policyRef}
howMeasured={props.howMeasured}
/>
<NextStepsList
steps={props.steps}
handleSubmit={props.handleSubmit}
/>
<NextStepsList steps={props.steps} handleSubmit={props.handleSubmit} />
</Card>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type AnalyticsType = "init" | "resume";
type AnalyticsLogDirection = AnalyticsType | "forwards" | "backwards";

export type HelpClickMetadata = Record<string, string>;
export type SelectedUrlsMetadata = Record<'selectedUrls', string[]>;
export type SelectedUrlsMetadata = Record<"selectedUrls", string[]>;

let lastAnalyticsLogId: number | undefined = undefined;

Expand Down
4 changes: 3 additions & 1 deletion editor.planx.uk/src/pages/Preview/StatusPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ const StatusPage: React.FC<Props> = ({
onClick={removeSessionIdSearchParam}
sx={contentFlowSpacing}
>
<Typography variant="body1" align="left">Start new application</Typography>
<Typography variant="body1" align="left">
Start new application
</Typography>
</Link>
</>
)}
Expand Down
3 changes: 0 additions & 3 deletions editor.planx.uk/src/ui/InputLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import React, { ReactNode } from "react";
const Root = styled("label")(() => ({
display: "block",
width: "100%",
"& > :not(:first-child)": {
width: "100%",
},
}));

export default function InputLabel(props: {
Expand Down
16 changes: 10 additions & 6 deletions editor.planx.uk/src/ui/NextStepsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ function LinkStep(props: ListItemProps) {
href={props.url}
target="_blank"
rel="noopener"
onClick={() => props.handleSelectingUrl && props.url && props.handleSelectingUrl(props.url)}
onClick={() =>
props.handleSelectingUrl &&
props.url &&
props.handleSelectingUrl(props.url)
}
>
<Step {...props} />
</InnerLink>
Expand Down Expand Up @@ -119,19 +123,19 @@ const Step = ({ title, description, url }: ListItemProps) => (

function NextStepsList(props: NextStepsListProps) {
const [selectedUrls, setSelectedUrls] = useState<string[]>([]);
const { trackNextStepsLinkClick } = useAnalyticsTracking()
const { trackNextStepsLinkClick } = useAnalyticsTracking();

const handleSelectingUrl = (newUrl: string) => {
setSelectedUrls(prevSelectedUrls => [...prevSelectedUrls, newUrl]);
trackNextStepsLinkClick({'selectedUrls': [...selectedUrls, newUrl]})
}
setSelectedUrls((prevSelectedUrls) => [...prevSelectedUrls, newUrl]);
trackNextStepsLinkClick({ selectedUrls: [...selectedUrls, newUrl] });
};

return (
<Root>
{props.steps?.map((step, i) => (
<StyledListItem key={i}>
{step.url ? (
<LinkStep {...step} handleSelectingUrl={handleSelectingUrl}/>
<LinkStep {...step} handleSelectingUrl={handleSelectingUrl} />
) : (
<ContinueStep {...step} handleSubmit={props.handleSubmit} />
)}
Expand Down
Loading