import React, { useState, useEffect } from 'react';
import { ButtonToggle, ButtonItem } from '@looker/components';
import { ExploreType } from '..';
export var DocResponseTypes = _ref => {
  var {
    api,
    responses
  } = _ref;
  var mediaTypes = Object.keys(responses);
  var [selectedMediaType, setSelectedMediaType] = useState(mediaTypes[0]);
  var [resps, setResps] = useState(responses);
  useEffect(() => {
    setSelectedMediaType(mediaTypes[0]);
    setResps(responses);
  }, [responses, mediaTypes]);
  return React.createElement(React.Fragment, null, React.createElement(ButtonToggle, {
    value: selectedMediaType,
    onChange: setSelectedMediaType,
    mt: "large",
    mb: "large"
  }, mediaTypes.map(mediaType => React.createElement(ButtonItem, {
    key: mediaType
  }, mediaType))), React.createElement("div", {
    style: {
      overflow: 'auto'
    }
  }, React.createElement(ExploreType, {
    api: api,
    key: selectedMediaType,
    type: resps[selectedMediaType].type,
    link: true,
    maxDepth: 2
  })));
};
//# sourceMappingURL=DocResponseTypes.js.map