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

chore: Fix React :nth-child warnings #3768

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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 @@ -30,7 +30,7 @@ const Content = styled(Box, {
"& a": {
color: getContrastTextColor(color || "#fff", theme.palette.link.main),
},
"& *:nth-child(1)": {
"& *:nth-of-type(1)": {
marginTop: 0,
},
}));
Expand Down
6 changes: 3 additions & 3 deletions editor.planx.uk/src/pages/FlowEditor/floweditor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ $fontMonospace: "Source Code Pro", monospace;
opacity: 0.6;
}

> span:not(:nth-child(1)) {
> span:not(:first-child) {
margin-left: 6px;
}
}
Expand Down Expand Up @@ -476,7 +476,7 @@ $fontMonospace: "Source Code Pro", monospace;
$lineWidth;
background-repeat: no-repeat, repeat-x, repeat-x;

&:nth-child(1) {
&:nth-of-type(1) {
background-position:
top center,
top right,
Expand Down Expand Up @@ -516,7 +516,7 @@ $fontMonospace: "Source Code Pro", monospace;
$lineWidth 100%,
2px 100%;

&:nth-child(1) {
&:nth-of-type(1) {
background-position:
left center,
left bottom,
Expand Down
3 changes: 2 additions & 1 deletion editor.planx.uk/src/ui/editor/RichTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export const RichContentContainer = styled(Box)(({ theme }) => ({
},
},
// Styles for placeholder text, to match ui/Input.tsx
"& p.is-editor-empty:nth-child(1)::before": {
// "& p.is-editor-empty:nth-child(1)::before": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lingering comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahah sorry - very good catch thank you 😅

Fixed in a0b896b

"& p.is-editor-empty:first-child::before": {
color: theme.palette.text.placeholder,
opacity: 1,
content: `attr(data-placeholder)`,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/ui/shared/InputRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Root = styled(Box, {
"& > *": {
flexGrow: 1,
marginRight: 5,
"&:nth-child(1)": {
"&:first:child": {
marginLeft: 0,
},
"&:last-child": {
Expand Down
3 changes: 0 additions & 3 deletions editor.planx.uk/src/ui/shared/InputRowLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const Label = styled(Typography)(({ theme }) => ({
flexGrow: 0,
paddingRight: theme.spacing(2),
alignSelf: "center",
"&:not(:nth-child(1))": {
paddingLeft: theme.spacing(2),
},
Comment on lines -10 to -12
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see where the style applies, tried all usual tricks of solid red borders, hotpink background etc to locate when this should apply without any luck.

})) as typeof Typography;

export default function InputRowLabel({ children }: { children: ReactNode }) {
Expand Down
Loading