import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _extends from "@babel/runtime/helpers/esm/extends";
import React, { memo } from 'react';
import PropTypes from 'prop-types'; // import { FormattedNumber } from 'gatsby-theme-fast-ai';

import { keyframes } from '@emotion/core';
import Dotdotdot from 'react-dotdotdot';
import Box from '../Box';
import Flex from '../Flex';
const backgroundFadeout = keyframes`
	0% {
		background-color: rgba(255, 0, 0, 1);
	}
	100% {
		background-color: rgba(255, 0, 0, 0);
	}
`;

const HighlightChangesText = (_ref) => {
  let rest = _extends({}, _ref);

  return /*#__PURE__*/React.createElement(Box, _extends({}, rest, {
    sx: {
      animationName: backgroundFadeout,
      animationDuration: '1.5s',
      animationTimingFunction: 'ease-out',
      animationFillMode: 'both'
    }
  }));
};

const ConsoleItem = (_ref2) => {
  let {
    value,
    label
  } = _ref2,
      rest = _objectWithoutProperties(_ref2, ["value", "label"]);

  return /*#__PURE__*/React.createElement(Flex, _extends({
    sx: {
      py: 2,
      px: 3,
      alignItems: 'center'
    }
  }, rest), /*#__PURE__*/React.createElement(Box, {
    as: "span",
    fontSize: 1,
    mb: 0
  }, label), /*#__PURE__*/React.createElement(HighlightChangesText, {
    title: value,
    key: value,
    as: "span",
    ml: "auto",
    mb: 0,
    fontSize: 1
  }, /*#__PURE__*/React.createElement(Dotdotdot, {
    clamp: 1
  }, value)));
};

process.env.NODE_ENV !== "production" ? ConsoleItem.propTypes = {
  label: PropTypes.string,
  value: PropTypes.any
} : void 0;
export default /*#__PURE__*/memo(ConsoleItem);