Skip to content

Commit fa8f241

Browse files
committed
updated JavaScript doc for breakpoints per code review suggestion
1 parent c276fed commit fa8f241

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

website/docs/foundations/breakpoints/partials/code/how-to-use.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,19 @@ For special use cases, we also provide a Sass map–`$hds-breakpoints`–which i
101101

102102
We also provide helpers in case you need to access the breakpoints names/values in JavaScript code.
103103

104-
You have access to the list of breakpoint names using the `hdsBreakpointsNames` array:
104+
You have access to the list of breakpoint names and values using the `hdsBreakpoints` map:
105105

106106
```javascript{data-execute=false}
107-
import { hdsBreakpointsNames } from '@hashicorp/design-system-components/utils/hds-breakpoints';
108-
109-
hdsBreakpointsNames.forEach(name => {
110-
// do something with the breakpoint names
111-
});
112-
```
113-
114-
You also have access to the list of breakpoint names and values using the `hdsBreakpointsValues` map:
115-
116-
```javascript{data-execute=false}
117-
import { hdsBreakpointsValues } from '@hashicorp/design-system-components/utils/hds-breakpoints';
107+
import { hdsBreakpoints } from '@hashicorp/design-system-components/utils/hds-breakpoints';
118108

119109
// do something with a specific breakpoint value
120-
const myBreakpoint = hdsBreakpointsValues['xl'].value; // numeric (eg. 1440)
121-
const myBreakpoint = hdsBreakpointsValues['lg'].px; // size in px (eg. 1088px)
122-
const myBreakpoint = hdsBreakpointsValues['sm'].rem; // size in rem (eg. 30rem)
110+
const myBreakpoint1 = hdsBreakpoints['xl'].value; // numeric (eg. 1440)
111+
const myBreakpoint2 = hdsBreakpoints['lg'].px; // size in px (eg. 1088px)
112+
const myBreakpoint3 = hdsBreakpoints['sm'].rem; // size in rem (eg. 30rem)
123113

124114
// loop over all the breakpoints
125-
Object.entries(hdsBreakpointsValues).forEach(([name, sizes]) => {
115+
Object.entries(hdsBreakpoints).forEach(([name, sizes]) => {
126116
// do something with a specific breakpoint value in px
127-
const breakpointSizePx = sizes.px;
117+
const myBreakpointSizePx = sizes.px;
128118
});
129119
```

0 commit comments

Comments
 (0)