Skip to content

Commit 485058b

Browse files
committed
feat(utils): add helper function to access global css breakpoint values
1 parent 1f1c5de commit 485058b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
$small: 600px;
22
$large: 1200px;
3+
4+
:root {
5+
--small: #{$small};
6+
--large: #{$large};
7+
}

src/utils/breakpoints.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function getBreakpointValue(breakpointName) {
2+
const breakpoints = {
3+
small: parseInt(getComputedStyle(document.documentElement).getPropertyValue("--small"), 10),
4+
large: parseInt(getComputedStyle(document.documentElement).getPropertyValue("--large"), 10),
5+
};
6+
7+
return breakpoints[breakpointName] || null;
8+
}

0 commit comments

Comments
 (0)