Skip to content

Commit

Permalink
fix: hide style props
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Feb 15, 2023
1 parent 0969920 commit 70ec88d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-pots-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chakra-ui/styled-system": patch
---

Fix issue where `hideFrom` and `hideBelow` doesn't work as expected
16 changes: 8 additions & 8 deletions packages/core/styled-system/src/config/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ export const layout: Config = {
hideFrom: {
scale: "breakpoints",
transform: (value: string, theme) => {
const { minWQuery = value } = theme.__breakpoints?.get(value) ?? {}
return {
[`@media screen and (min-width: ${minWQuery})`]: { display: "none" },
}
const mq =
theme.__breakpoints?.get(value)?.minWQuery ??
`@media screen and (min-width: ${value})`
return { [mq]: { display: "none" } }
},
},
hideBelow: {
scale: "breakpoints",
transform: (value: string, theme) => {
const { maxWQuery = value } = theme.__breakpoints?.get(value) ?? {}
return {
[`@media screen and (max-width: ${maxWQuery})`]: { display: "none" },
}
const mq =
theme.__breakpoints?.get(value)?.maxWQuery ??
`@media screen and (max-width: ${value})`
return { [mq]: { display: "none" } }
},
},
verticalAlign: true,
Expand Down

1 comment on commit 70ec88d

@vercel
Copy link

@vercel vercel bot commented on 70ec88d Feb 15, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.