Skip to content

Commit

Permalink
Update useWindowSize docs as per feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarrow committed Oct 3, 2023
1 parent df7ffbf commit 9436389
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion website/docs/styling-layout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ Docusaurus uses `996px` as the cutoff between mobile screen width and desktop. I
}
```

:::tip Header and Sidebar Some components, such as the header and sidebar, use a `useWindowSize` hook to set their breakpoint value. If you change the breakpoint value in your custom CSS, you probably also want to update the invocations of the `useWindowSize` hook by swizzling the components it's used in and passing it an argument that updates the breakpoint value (for example, to change the breakpoint to 796px, pass the object `{ desktopThresholdWidth: 796 }` as an argument to the `useWindowSize` hook). :::
:::tip Customizing the breakpoint

Some React components, such as the header and the sidebar, implement different JavaScript logic when in mobile view by calling the [`useWindowSize`](./swizzling.mdx) hook. If you change the breakpoint value in your custom CSS, you probably also want to update the invocations of the `useWindowSize` hook by swizzling the components it's used in and passing an explicit option argument. For example, to change the breakpoint to 796px, pass the argument `796` to the `useWindowSize` hook.

:::

## CSS modules {#css-modules}

Expand Down

0 comments on commit 9436389

Please sign in to comment.