mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-12 17:50:51 +01:00
29 lines
741 B
JavaScript
29 lines
741 B
JavaScript
|
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 (
|
||
|
<StyledWrapper>
|
||
|
<span className={getClassname(item.request.method)}>{item.request.method}</span>
|
||
|
</StyledWrapper>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default RequestMethod;
|