diff --git a/renderer/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/StyledWrapper.js b/renderer/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/StyledWrapper.js new file mode 100644 index 000000000..4115c4486 --- /dev/null +++ b/renderer/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/StyledWrapper.js @@ -0,0 +1,11 @@ +import styled from 'styled-components'; + +const Wrapper = styled.div` + .method-get { color: var(--color-method-get);} + .method-post { color: var(--color-method-post);} + .method-put { color: var(--color-method-put);} + .method-delete { color: var(--color-method-delete);} + .method-patch { color: var(--color-method-patch);} +`; + +export default Wrapper; diff --git a/renderer/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/index.js b/renderer/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/index.js new file mode 100644 index 000000000..6edceedf4 --- /dev/null +++ b/renderer/components/Sidebar/Collections/Collection/CollectionItem/RequestMethod/index.js @@ -0,0 +1,28 @@ +import React from 'react'; +import classnames from 'classnames'; +import StyledWrapper from './StyledWrapper'; + +const RequestMethod = ({item}) => { + if(!['http-request', 'graphql-request'].includes(item.type)) { + return null; + } + + const getClassname = (method = '') => { + method = method.toLocaleLowerCase(); + return classnames("mr-1", { + 'method-get': method === 'get', + 'method-post': method === 'post', + 'method-put': method === 'put', + 'method-delete': method === 'delete', + 'method-patch': method === 'patch' + }); + }; + + return ( + + {item.request.method} + + ); +}; + +export default RequestMethod; diff --git a/renderer/components/Sidebar/Collections/Collection/CollectionItem/index.js b/renderer/components/Sidebar/Collections/Collection/CollectionItem/index.js index 3d7aa3f4c..81f77747c 100644 --- a/renderer/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/renderer/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -6,6 +6,7 @@ import { useStore } from 'providers/Store'; import { IconChevronRight, IconDots } from '@tabler/icons'; import classnames from 'classnames'; import Dropdown from 'components/Dropdown'; +import RequestMethod from './RequestMethod'; import StyledWrapper from './StyledWrapper'; @@ -90,7 +91,10 @@ const CollectionItem = ({item, collectionUid}) => { ) : null} - {item.name} +
+ + {item.name} +
} placement='bottom-start'> diff --git a/renderer/styles/globals.css b/renderer/styles/globals.css index a69faf43d..141530666 100644 --- a/renderer/styles/globals.css +++ b/renderer/styles/globals.css @@ -11,6 +11,11 @@ --color-codemirror-border: #efefef; --color-codemirror-background: rgb(243, 243, 243); --color-text-link: #1663bb; + --color-method-get: rgb(5, 150, 105); + --color-method-post: #8e44ad; + --color-method-put: #8e44ad; + --color-method-delete: #8e44ad; + --color-method-patch: #8e44ad; } html, body {