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

🐛 Can't overwrite paddingX with paddingLeft or paddingRight #1210

Open
tjosepo opened this issue Apr 18, 2023 · 0 comments
Open

🐛 Can't overwrite paddingX with paddingLeft or paddingRight #1210

tjosepo opened this issue Apr 18, 2023 · 0 comments
Labels

Comments

@tjosepo
Copy link
Member

tjosepo commented Apr 18, 2023

Describe the bug

When the paddingX styleprop is used, it becomes impossible to overwrite the padding with paddingLeft or paddingRight.

This can be a pitfall when creating custom components that can use prop spreading to get styles from a parent.

Steps to reproduce

function MyCustomComponent(props: DivProps) {
  return (
    <Div paddingX="20px" {...props}>
      Hello there!
    </Div>
  );
}

function App() {
  return <MyCustomComponent paddingLeft="50px" />; // ⚠️ This padding will NOT be applied! It will stay 20px.
}

Expected results

Because paddingLeft is more specific than paddingX, I expect it to take precedence over the paddingX rule.

Reproducible demo

https://codesandbox.io/embed/paddingx-paddingleft-bug-orbit-x4r5jd?fontsize=14&hidenavigation=1&module=%2FApp.tsx&theme=dark

@tjosepo tjosepo added the bug label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant