import React from 'react'; import classnames from 'classnames'; import { IconHome2 } from '@tabler/icons'; import StyledWrapper from './StyledWrapper'; const RequestTabs = ({actions, dispatch, activeRequestTabId, requestTabs}) => { const getTabClassname = (tab, index) => { return classnames("request-tab select-none", { 'active': tab.id === activeRequestTabId, 'last-tab': requestTabs && requestTabs.length && (index === requestTabs.length - 1) }); }; const getMethodColor = (method) => { let color = ''; switch(method) { case 'GET': { color = 'rgb(5, 150, 105)'; break; } case 'POST': { color = '#8e44ad'; break; } } return color; }; const handleClick = (tab) => { dispatch({ type: actions.REQUEST_TAB_CLICK, requestTab: tab }); }; const handleCloseClick = (event, tab) => { event.stopPropagation(); event.preventDefault(); dispatch({ type: actions.REQUEST_TAB_CLOSE, requestTab: tab }); }; const createNewTab = () => { dispatch({ type: actions.ADD_NEW_HTTP_REQUEST }); }; return ( {requestTabs && requestTabs.length ? ( ) : null} ); }; export default RequestTabs;