Skip to content

Commit

Permalink
Fix useResponsiveProp not being inclusive when calculating breakpoints (
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwooding authored Nov 15, 2024
1 parent 1a29b4e commit 7432f62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-bugs-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/core": patch
---

Fixed useResponsiveProp not being inclusive when calculating breakpoints e.g. not recognising `600px` as `sm`.
2 changes: 1 addition & 1 deletion packages/core/src/__tests__/__e2e__/dialog/Dialog.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe("GIVEN a Dialog", () => {

cy.findByRole("button", { name: "Open dialog" }).realClick();

cy.findByRole("dialog").should("have.class", "saltDialog-small-xs");
cy.findByRole("dialog").should("have.class", "saltDialog-small-sm");
},
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/useResponsiveProp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getCurrentBreakpoint = (
(acc, val) => {
const [, accWidth] = acc;
const [breakpoint, breakpointWidth] = val;
if (breakpointWidth < width && breakpointWidth > accWidth) {
if (breakpointWidth <= width && breakpointWidth > accWidth) {
return [breakpoint, breakpointWidth];
}
return acc;
Expand Down

0 comments on commit 7432f62

Please sign in to comment.