import React, { useState } from 'react';
import { Row, Col, Breadcrumb, BreadcrumbItem, Button, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap';
import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism';
import classnames from 'classnames';
import { tomorrow } from 'react-syntax-highlighter/dist/esm/styles/prism';

const Buttons = () => {
  const [tabs, setTabs] = useState({
    defaultButtonTabId: '1',
    outlineButtonsTabId: '1',
    buttonsSizeTabId: '1'
  });

  const changeTab = (field, id) => {
    setTabs((prevState) => ({
      ...prevState,
      [field]: id,
    }));
  };

  return (
      <Row>
        <Col md={10}>
          <Breadcrumb>
            <BreadcrumbItem>YOU ARE HERE</BreadcrumbItem>
            <BreadcrumbItem>Documentation</BreadcrumbItem>
            <BreadcrumbItem>Components</BreadcrumbItem>
            <BreadcrumbItem active>Buttons</BreadcrumbItem>
          </Breadcrumb>
        </Col>

        <Col lg={9}>
          <h2>Buttons</h2>
          <p className="mb-lg">Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.</p>
          <SyntaxHighlighter language='javascript' style={tomorrow}>
            {"import { Button } from 'reactstrap';"}
          </SyntaxHighlighter>
          <Nav tabs className="bg-transparent mt">
            <NavItem>
              <NavLink
                className={classnames({ active: tabs.defaultButtonTabId === '1' })}
                onClick={() => {
                  changeTab('defaultButtonTabId', '1');
                }}
              >
                Example
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink
                className={classnames({ active: tabs.defaultButtonTabId === '2' })}
                onClick={() => {
                  changeTab('defaultButtonTabId', '2');
                }}
              >
                Code
              </NavLink>
            </NavItem>
          </Nav>
          <TabContent className="mb-xlg" activeTab={tabs.defaultButtonTabId}>
            <TabPane tabId="1">
              <Button color="default" className="width-100 mb-xs me-1">Default</Button>
              <Button color="primary" className="width-100 mb-xs me-1">Primary</Button>
              <Button color="info" className="width-100 mb-xs me-1">Info</Button>
              <Button color="success" className="width-100 mb-xs me-1">Success</Button>
              <Button color="warning" className="width-100 mb-xs me-1">Warning</Button>
              <Button color="danger" className="width-100 mb-xs me-1">Danger</Button>
              <Button color="gray" className="width-100 mb-xs me-1">Gray</Button>
              <Button color="inverse" className="width-100 mb-xs me-1">Inverse</Button>
            </TabPane>
            <TabPane tabId="2">
              <SyntaxHighlighter language='javascript' style={tomorrow}>{'<Button color="default" className="width-100 mb-xs me-1">Default</Button>\n' +
              '<Button color="primary">Primary</Button>\n' +
              '<Button color="info">Info</Button>\n' +
              '<Button color="success">Success</Button>\n' +
              '<Button color="warning"">Warning</Button>\n' +
              '<Button color="danger">Danger</Button>\n' +
              '<Button color="gray">Gray</Button>\n' +
              '<Button color="inverse">Inverse</Button>'}</SyntaxHighlighter>
            </TabPane>
          </TabContent>
          <Nav tabs className="bg-transparent">
            <NavItem>
              <NavLink
                className={classnames({ active: tabs.outlineButtonsTabId === '1' })}
                onClick={() => {
                  changeTab('outlineButtonsTabId', '1');
                }}
              >
                Example
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink
                className={classnames({ active: tabs.outlineButtonsTabId === '2' })}
                onClick={() => {
                  changeTab('outlineButtonsTabId', '2');
                }}
              >
                Code
              </NavLink>
            </NavItem>
          </Nav>
          <TabContent className="mb-xlg" activeTab={tabs.outlineButtonsTabId}>
            <TabPane tabId="1">
              <Button outline color="default" className="width-100 mb-xs me-1">Default</Button>
              <Button outline color="primary" className="width-100 mb-xs me-1">Primary</Button>
              <Button outline color="info" className="width-100 mb-xs me-1">Info</Button>
              <Button outline color="success" className="width-100 mb-xs me-1">Success</Button>
              <Button outline color="warning" className="width-100 mb-xs me-1">Warning</Button>
              <Button outline color="danger" className="width-100 mb-xs me-1">Danger</Button>
              <Button outline color="gray" className="width-100 mb-xs me-1">Gray</Button>
              <Button outline color="inverse" className="width-100 mb-xs me-1">Inverse</Button>
            </TabPane>
            <TabPane tabId="2">
              <SyntaxHighlighter language='javascript' style={tomorrow}>
                {'<Button outline color="default">Default</Button>\n' +
                '<Button outline color="primary">Primary</Button>\n' +
                '<Button outline color="info">Info</Button>\n' +
                '<Button outline color="success">Success</Button>\n' +
                '<Button outline color="warning">Warning</Button>\n' +
                '<Button outline color="danger">Danger</Button>\n' +
                '<Button outline color="gray"">Gray</Button>\n' +
                '<Button outline color="inverse">Inverse</Button>'}
              </SyntaxHighlighter>
            </TabPane>
          </TabContent>
          <Nav tabs className="bg-transparent">
            <NavItem>
              <NavLink
                className={classnames({ active: tabs.buttonsSizeTabId === '1' })}
                onClick={() => {
                  changeTab('buttonsSizeTabId', '1');
                }}
              >
                Example
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink
                className={classnames({ active: tabs.buttonsSizeTabId === '2' })}
                onClick={() => {
                  changeTab('buttonsSizeTabId', '2');
                }}
              >
                Code
              </NavLink>
            </NavItem>
          </Nav>
          <TabContent className="mb-xlg" activeTab={tabs.buttonsSizeTabId}>
            <TabPane tabId="1">
              <p className="fs-mini text-muted">
                Fancy larger or smaller buttons?
                Four separate sizes available for all use cases:
                from tiny 10px button to large one.
              </p>
              <p>
                <Button color="default" size="lg" className="mb-xs me-1">Large button</Button>
                <Button color="primary" className="mb-xs me-1">Default button</Button>
                <Button color="info" size="sm" className="mb-xs me-1">Small button</Button>
                <Button color="success" size="xs" className="mb-xs me-1">Tiny button</Button>
              </p>
            </TabPane>
            <TabPane tabId="2">
              <SyntaxHighlighter language='javascript' style={tomorrow}>
                {'<Button color="default" size="lg">Large button</Button>\n' +
                '<Button color="primary">Default button</Button>\n' +
                '<Button color="info" size="sm">Small button</Button>\n' +
                '<Button color="success" size="xs">Tiny button</Button>'}
              </SyntaxHighlighter>
            </TabPane>
          </TabContent>
          For more examples please refer to <a href="https://reactstrap.github.io/components/buttons/" target="_blank" rel="noopener noreferrer">Reactstrap Buttons</a>
        </Col>
      </Row>
  );
};

export default Buttons;
