Skip to content

Conversation

DanielDu95
Copy link

Description

This PR adds support for handling !important CSS declarations within the useCss hook. Previously, the hook did not handle the !important flag correctly, leading to CSS declarations being overridden by other styles that did support !important.

To fix this, I patched the nano-css package to ensure that the !important flag is respected when passed in the CSS object. This patch makes sure the styles are applied as expected, even when !important is included in the CSS.

Motivation and Context

The primary motivation for this change is to provide better compatibility with styles that require !important to override higher specificity styles. This behavior is common in certain UI libraries and frameworks where developers need to enforce specific styles.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Comment the code, particularly in hard-to-understand areas
  • Add documentation
  • Add hook's story at Storybook
  • Cover changes with tests
  • Ensure the test suite passes (yarn test)
  • Provide 100% tests coverage
  • Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • Make sure types are fine (yarn lint:types).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant