We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that styled-system is moving to use break-points with units (again?) https://styled-system.com/guides/migrating#changes
The theme.breakpoints object must specify CSS units. Numbers are no longer converted to pixel values.
This I guess will break https://github.com/jameslnewell/styled-components-breakpoint/blob/master/src/core.js#L49
Is it a goal of this project to be compatible with styled-system as well?
In any case. Can I 'globally' change the toCSS mapping function to avoid the situation highlighted in L49 above?
toCSS
The text was updated successfully, but these errors were encountered:
If anyone else is using this lib with styled-system v5 here is a "patch" I use to make the lib compatible:
import breakpoint from 'styled-components-breakpoint' const stripUnit = val => Number.isInteger(val) ? val : Number(`${val}`.replace(/\D/g, '')) const breakpointUnitless = name => (...templateProps) => { const breakpoint_ = breakpoint(name)(...templateProps) return props => { const props_ = { theme: { ...props.theme }, } props_.theme.breakpoints = Object.entries(props_.theme.breakpoints).reduce( (bps, [name, val]) => { bps[name] = stripUnit(val) return bps }, {}, ) return breakpoint_(props_) } } export default breakpointUnitless
Then import this in place of breakpoint, e.g.:
import breakpoint from './breakpoint-patch.js' const Header = styled(Box)` color: green; ${breakpoint('md')` color: red; `} `
Sorry, something went wrong.
To support breakpoint between syntax (ex: breakpoint('sm, ''md')), can update arguments link bellow:
breakpoint('sm, ''md')
const breakpointUnitless = (gte, lt) => (...templateProps) => { const breakpoint_ = breakpoint(gte, lt)(...templateProps) return props => { ... } }
No branches or pull requests
It seems that styled-system is moving to use break-points with units (again?) https://styled-system.com/guides/migrating#changes
This I guess will break https://github.com/jameslnewell/styled-components-breakpoint/blob/master/src/core.js#L49
Is it a goal of this project to be compatible with styled-system as well?
In any case. Can I 'globally' change the
toCSS
mapping function to avoid the situation highlighted in L49 above?The text was updated successfully, but these errors were encountered: