feat: click on new tab icon creates a new tab

This commit is contained in:
Anoop M D 2022-01-09 22:21:03 +05:30
parent 8da4e71d47
commit 3037c3564e

View File

@ -42,6 +42,12 @@ const RequestTabs = ({actions, dispatch, activeRequestTabId, requestTabs}) => {
}); });
}; };
const createNewTab = () => {
dispatch({
type: actions.ADD_NEW_HTTP_REQUEST
});
};
return ( return (
<StyledWrapper className="mt-3 flex items-center"> <StyledWrapper className="mt-3 flex items-center">
{requestTabs && requestTabs.length ? ( {requestTabs && requestTabs.length ? (
@ -63,7 +69,7 @@ const RequestTabs = ({actions, dispatch, activeRequestTabId, requestTabs}) => {
</div> </div>
</li> </li>
}) : null} }) : null}
<li className="select-none new-tab ml-1"> <li className="select-none new-tab ml-1" onClick={createNewTab}>
<div className="flex items-center"> <div className="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/> <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>