@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.
package/dst/index.esm.js CHANGED
@@ -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
 
@@ -1721,8 +1720,9 @@ var Metadata = function Metadata(_ref2) {
1721
1720
  sx: {
1722
1721
  userSelect: 'none',
1723
1722
  position: 'fixed',
1724
- bottom: 42,
1725
- right: 24,
1723
+ bottom: '42px',
1724
+ right: '24px',
1725
+ width: '87px',
1726
1726
  transformOrigin: 'right',
1727
1727
  transform: 'rotate(90deg)',
1728
1728
  display: ['none', 'none', 'initial']
@@ -2039,7 +2039,6 @@ var Layout = function Layout(_ref) {
2039
2039
  _ref$container = _ref.container,
2040
2040
  container = _ref$container === void 0 ? true : _ref$container;
2041
2041
  var content = children;
2042
- var index = useBreakpointIndex();
2043
2042
 
2044
2043
  if (fade) {
2045
2044
  content = /*#__PURE__*/React.createElement(FadeIn, {
@@ -2055,11 +2054,24 @@ var Layout = function Layout(_ref) {
2055
2054
  }, /*#__PURE__*/React.createElement(Container, null, content));
2056
2055
  }
2057
2056
 
2057
+ var _useThemeUI = useThemeUI(),
2058
+ theme = _useThemeUI.theme;
2059
+
2058
2060
  useEffect(function () {
2059
- if (index > 2 && settings != null && settings.value && settings != null && settings.onClick) {
2060
- settings == null ? void 0 : settings.onClick();
2061
- }
2062
- }, [index, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2061
+ if (!theme) return;
2062
+
2063
+ var handler = function handler() {
2064
+ if (settings != null && settings.value && settings != null && settings.onClick) {
2065
+ settings == null ? void 0 : settings.onClick();
2066
+ }
2067
+ };
2068
+
2069
+ var query = window.matchMedia("(max-width: " + theme.breakpoints[1] + ")");
2070
+ query.addListener(handler);
2071
+ return function () {
2072
+ query.removeListener(handler);
2073
+ };
2074
+ }, [theme, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2063
2075
  var menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2064
2076
  key: "dimmer",
2065
2077
  sx: {
@@ -2073,6 +2085,7 @@ var Layout = function Layout(_ref) {
2073
2085
  menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2074
2086
  key: "settings",
2075
2087
  sx: {
2088
+ mr: ['2px'],
2076
2089
  display: ['inherit', 'inherit', 'none', 'none']
2077
2090
  }
2078
2091
  }, settings)));