@carbonplan/components 11.0.2 → 11.0.5-develop.1

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
 
@@ -1682,8 +1681,9 @@ const Metadata = ({
1682
1681
  sx: {
1683
1682
  userSelect: 'none',
1684
1683
  position: 'fixed',
1685
- bottom: 42,
1686
- right: 24,
1684
+ bottom: '42px',
1685
+ right: '24px',
1686
+ width: '87px',
1687
1687
  transformOrigin: 'right',
1688
1688
  transform: 'rotate(90deg)',
1689
1689
  display: ['none', 'none', 'initial']
@@ -1992,7 +1992,6 @@ const Layout = ({
1992
1992
  container: _container = true
1993
1993
  }) => {
1994
1994
  let content = children;
1995
- const index = useBreakpointIndex();
1996
1995
 
1997
1996
  if (_fade) {
1998
1997
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -2008,11 +2007,24 @@ const Layout = ({
2008
2007
  }, /*#__PURE__*/React.createElement(Container, null, content));
2009
2008
  }
2010
2009
 
2010
+ const {
2011
+ theme
2012
+ } = useThemeUI();
2011
2013
  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]);
2014
+ if (!theme) return;
2015
+
2016
+ const handler = () => {
2017
+ if (settings != null && settings.value && settings != null && settings.onClick) {
2018
+ settings == null ? void 0 : settings.onClick();
2019
+ }
2020
+ };
2021
+
2022
+ const query = window.matchMedia(`(max-width: ${theme.breakpoints[1]})`);
2023
+ query.addListener(handler);
2024
+ return () => {
2025
+ query.removeListener(handler);
2026
+ };
2027
+ }, [theme, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2016
2028
  const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2017
2029
  key: "dimmer",
2018
2030
  sx: {
@@ -2026,6 +2038,7 @@ const Layout = ({
2026
2038
  menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2027
2039
  key: "settings",
2028
2040
  sx: {
2041
+ mr: ['2px'],
2029
2042
  display: ['inherit', 'inherit', 'none', 'none']
2030
2043
  }
2031
2044
  }, settings)));