@carbonplan/components 11.0.1 → 11.0.5-develop.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,6 @@ import { transparentize } from '@theme-ui/color';
4
4
  import NextLink from 'next/link';
5
5
  import { Arrow, Sun } from '@carbonplan/icons';
6
6
  import { PoopSad } from '@carbonplan/emoji';
7
- import { useBreakpointIndex } from '@theme-ui/match-media';
8
7
  import Head from 'next/head';
9
8
  import { keyframes } from '@emotion/react';
10
9
 
@@ -543,7 +542,7 @@ const Label = ({
543
542
  horizontal
544
543
  }) => /*#__PURE__*/React.createElement(Box, {
545
544
  sx: !horizontal && {
546
- width: ['12px', '17px', '17px', '19px'],
545
+ width: ['13px', '17px', '17px', '19px'],
547
546
  alignSelf: 'flex-end'
548
547
  }
549
548
  }, /*#__PURE__*/React.createElement(Box, {
@@ -1992,7 +1991,6 @@ const Layout = ({
1992
1991
  container: _container = true
1993
1992
  }) => {
1994
1993
  let content = children;
1995
- const index = useBreakpointIndex();
1996
1994
 
1997
1995
  if (_fade) {
1998
1996
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -2008,11 +2006,24 @@ const Layout = ({
2008
2006
  }, /*#__PURE__*/React.createElement(Container, null, content));
2009
2007
  }
2010
2008
 
2009
+ const {
2010
+ theme
2011
+ } = useThemeUI();
2011
2012
  useEffect(() => {
2012
- if (index > 2 && settings != null && settings.value && settings != null && settings.onClick) {
2013
- settings == null ? void 0 : settings.onClick();
2014
- }
2015
- }, [index, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2013
+ if (!theme) return;
2014
+
2015
+ const handler = () => {
2016
+ if (settings != null && settings.value && settings != null && settings.onClick) {
2017
+ settings == null ? void 0 : settings.onClick();
2018
+ }
2019
+ };
2020
+
2021
+ const query = window.matchMedia(`(max-width: ${theme.breakpoints[1]})`);
2022
+ query.addListener(handler);
2023
+ return () => {
2024
+ query.removeListener(handler);
2025
+ };
2026
+ }, [theme, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2016
2027
  const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2017
2028
  key: "dimmer",
2018
2029
  sx: {
@@ -2026,6 +2037,7 @@ const Layout = ({
2026
2037
  menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2027
2038
  key: "settings",
2028
2039
  sx: {
2040
+ mr: ['2px'],
2029
2041
  display: ['inherit', 'inherit', 'none', 'none']
2030
2042
  }
2031
2043
  }, settings)));