/** @jsx jsx */ import { jsx } from '@emotion/react'; // eslint-disable-line no-unused-vars import { Component } from 'react'; import CodeSandboxer from 'react-codesandboxer'; import { CodeBlock } from './markdown/renderer'; import pkg from '../packages/react-select/package.json'; import { defaultTheme } from 'react-select'; import Svg from './Svg'; const { colors } = defaultTheme; const gitInfo = { account: 'JedWatson', repository: 'react-select', branch: 'master', host: 'github', }; const sourceUrl = `https://github.com/${gitInfo.account}/react-select/tree/${gitInfo.branch}`; export default class ExampleWrapper extends Component { state = { isHovered: false, showCode: false }; static defaultProps = { isEditable: true }; handleEnter = () => this.setState({ isHovered: true }); handleLeave = () => this.setState({ isHovered: false }); renderCodeSample = () => { let { raw } = this.props; let { showCode } = this.state; if (!showCode || !raw) { return null; } else { return ; } }; renderSourceViewOption = () => { let { raw } = this.props; let { showCode } = this.state; if (!raw) { return ( ); } else { return ( this.setState({ showCode: !showCode })} title="View Source" > ); } }; renderCSBButton = () => { let { isEditable, raw, urlPath } = this.props; if (isEditable) { return ( {({ isLoading }) => ( {isLoading ? : } )} ); } else { return null; } }; render() { const { isHovered } = this.state; return (

{this.props.label}

{this.renderSourceViewOption()} {this.renderCSBButton()}
{this.renderCodeSample()} {this.props.children}
); } } const ExampleHeading = (props: any) => (
h4': { margin: 0, }, }} {...props} /> ); // ============================== // Source & Sandbox Actions // ============================== const SourceIcon = (props: any) => ( ); const NewWindowIcon = (props: any) => ( ); type ActionProps = { children: string, css?: Object, tag: 'a' | 'button', }; const Action = ({ css, tag: Tag = 'button', ...props }: ActionProps) => { return ( ); }; const Actions = ({ show, ...props }) => (
); // ============================== // Spinner // ============================== const Spinner = () => { const offset = 187; const duration = '1.4s'; const size = 16; return (
); };