@carbonplan/components 11.0.4 → 11.0.5-develop.3

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
 
@@ -1574,7 +1573,8 @@ const GitSha = () => {
1574
1573
  const href = 'https://github.com/' + owner + '/' + slug + '/tree/' + sha;
1575
1574
  return /*#__PURE__*/React.createElement(Box, {
1576
1575
  sx: {
1577
- display: 'inline-block'
1576
+ display: 'inline-block',
1577
+ width: '87px'
1578
1578
  }
1579
1579
  }, /*#__PURE__*/React.createElement(Separator, {
1580
1580
  color: color
@@ -1596,7 +1596,8 @@ const GitSha = () => {
1596
1596
  // fallback
1597
1597
  return /*#__PURE__*/React.createElement(Box, {
1598
1598
  sx: {
1599
- display: 'inline-block'
1599
+ display: 'inline-block',
1600
+ width: '87px'
1600
1601
  }
1601
1602
  }, /*#__PURE__*/React.createElement(Separator, {
1602
1603
  color: color
@@ -1682,8 +1683,8 @@ const Metadata = ({
1682
1683
  sx: {
1683
1684
  userSelect: 'none',
1684
1685
  position: 'fixed',
1685
- bottom: 42,
1686
- right: 24,
1686
+ bottom: '42px',
1687
+ right: '24px',
1687
1688
  transformOrigin: 'right',
1688
1689
  transform: 'rotate(90deg)',
1689
1690
  display: ['none', 'none', 'initial']
@@ -1992,7 +1993,6 @@ const Layout = ({
1992
1993
  container: _container = true
1993
1994
  }) => {
1994
1995
  let content = children;
1995
- const index = useBreakpointIndex();
1996
1996
 
1997
1997
  if (_fade) {
1998
1998
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -2008,11 +2008,24 @@ const Layout = ({
2008
2008
  }, /*#__PURE__*/React.createElement(Container, null, content));
2009
2009
  }
2010
2010
 
2011
+ const {
2012
+ theme
2013
+ } = useThemeUI();
2011
2014
  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]);
2015
+ if (!theme) return;
2016
+
2017
+ const handler = e => {
2018
+ if (e.matches && settings != null && settings.value && settings != null && settings.onClick) {
2019
+ settings == null ? void 0 : settings.onClick();
2020
+ }
2021
+ };
2022
+
2023
+ const query = window.matchMedia(`(min-width: ${theme.breakpoints[1]})`);
2024
+ query.onchange = handler;
2025
+ return () => {
2026
+ query.onchange = null;
2027
+ };
2028
+ }, [theme, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2016
2029
  const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2017
2030
  key: "dimmer",
2018
2031
  sx: {