Skip to content

Commit

Permalink
fix(SSR): change the unreliable pseudo class :first-child to :first-o…
Browse files Browse the repository at this point in the history
…f-type
  • Loading branch information
austin_hung committed Nov 5, 2020
1 parent 804b5ea commit dab6c84
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/react-styled-ui/src/Checkbox/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const interactionProps = ({ color, colorMode }) => {
bg: 'inherit',
borderColor: checkedAndFocusBorderColor,
color: checkedAndFocusColor, // Icon color
'& > :first-child': {
'& > div:first-of-type': {
bg: checkedAndFocusBgColor,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-styled-ui/src/Input/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const getInputGroupCSS = ({
const useNegativeMargin = (variant === 'outline' || variant === 'filled');

return {
'&:not(:first-child)': {
'&:not(:first-of-type)': {
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react-styled-ui/src/InputGroupAppend/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const notLastChildStyle = {
const baseProps = {
ml: -1,
css: {
'& > *:first-child': notFirstChildStyle,
'&:not(:last-child) > *:first-child': notLastChildStyle,
'& > *:first-of-type': notFirstChildStyle,
'&:not(:last-child) > *:first-of-type': notLastChildStyle,
}
};

Expand Down
4 changes: 2 additions & 2 deletions packages/react-styled-ui/src/InputGroupPrepend/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const notLastChildStyle = {
const baseProps = {
mr: -1,
css: {
'& > *:first-child': notLastChildStyle,
'&:not(:first-child) > *:first-child': notFirstChildStyle,
'& > *:first-of-type': notLastChildStyle,
'&:not(:first-of-type) > *:first-of-type': notFirstChildStyle,
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/styled-ui-docs/components/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Main = React.forwardRef(({ children, ...props }, ref) => {
px="6x"
backgroundColor={backgroundColor}
css={css`
>:first-child {
>:first-of-type {
margin-top: 0!important;
}
>:last-child {
Expand Down
28 changes: 14 additions & 14 deletions packages/styled-ui-docs/pages/buttongroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function Example() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -97,7 +97,7 @@ function Example() {
<ButtonGroup
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down Expand Up @@ -161,7 +161,7 @@ function Example() {
size="sm"
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -174,7 +174,7 @@ function Example() {
size="md"
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -187,7 +187,7 @@ function Example() {
size="lg"
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -202,7 +202,7 @@ function Example() {
size="sm"
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -217,7 +217,7 @@ function Example() {
size="md"
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -232,7 +232,7 @@ function Example() {
size="lg"
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down Expand Up @@ -288,7 +288,7 @@ function Example() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -301,7 +301,7 @@ function Example() {
orientation="vertical"
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginTop: -1
}
}}
Expand All @@ -315,7 +315,7 @@ function Example() {
<ButtonGroup
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -330,7 +330,7 @@ function Example() {
orientation="vertical"
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginTop: -1
}
}}
Expand Down Expand Up @@ -530,7 +530,7 @@ function SwitchButton() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand All @@ -555,7 +555,7 @@ function SwitchButton() {
<ButtonGroup
variant="ghost"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/styled-ui-docs/pages/modal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function Example() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down
4 changes: 2 additions & 2 deletions packages/styled-ui-docs/pages/pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function Minor() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down Expand Up @@ -188,7 +188,7 @@ function Minor() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/styled-ui-docs/pages/transition.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function Example() {
<ButtonGroup
variant="secondary"
css={{
'> *:not(:first-child)': {
'> *:not(:first-of-type)': {
marginLeft: -1
}
}}
Expand Down

0 comments on commit dab6c84

Please sign in to comment.