feat: dark-mode (response status and support modal)

This commit is contained in:
Anoop M D 2022-10-23 05:32:47 +05:30
parent 04a0a37ca4
commit 2ba6e4823d
14 changed files with 48 additions and 22 deletions

View File

@ -1,7 +1,7 @@
import styled from 'styled-components'; import styled from 'styled-components';
const StyledWrapper = styled.div` const StyledWrapper = styled.div`
color: var(--color-text); color: ${(props) => props.theme.text};
.collection-options { .collection-options {
svg { svg {
position: relative; position: relative;

View File

@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import Modal from 'components/Modal/index'; import Modal from 'components/Modal/index';
import { IconSpeakerphone, IconBrandTwitter } from '@tabler/icons'; import { IconSpeakerphone, IconBrandTwitter, IconBrandGithub } from '@tabler/icons';
import StyledWrapper from './StyledWrapper'; import StyledWrapper from './StyledWrapper';
import GithubSvg from 'assets/github.svg';
const BrunoSupport = ({ onClose }) => { const BrunoSupport = ({ onClose }) => {
return ( return (
@ -10,19 +9,19 @@ const BrunoSupport = ({ onClose }) => {
<Modal size="sm" title={'Support'} handleCancel={onClose} hideFooter={true}> <Modal size="sm" title={'Support'} handleCancel={onClose} hideFooter={true}>
<div className="collection-options"> <div className="collection-options">
<div className="mt-2"> <div className="mt-2">
<a href="https://github.com/usebruno/bruno/issues" target="_blank" className="flex items-center"> <a href="https://github.com/usebruno/bruno/issues" target="_blank" className="flex items-end">
<IconSpeakerphone size={18} strokeWidth={2} /> <IconSpeakerphone size={18} strokeWidth={2} />
<span className="label ml-2">Report Issues</span> <span className="label ml-2">Report Issues</span>
</a> </a>
</div> </div>
<div className="mt-2"> <div className="mt-2">
<a href="https://github.com/usebruno/bruno" target="_blank" className="flex items-center"> <a href="https://github.com/usebruno/bruno" target="_blank" className="flex items-end">
<img src={GithubSvg.src} style={{ width: '18px' }} /> <IconBrandGithub size={18} strokeWidth={2} />
<span className="label ml-2">Github</span> <span className="label ml-2">Github</span>
</a> </a>
</div> </div>
<div className="mt-2"> <div className="mt-2">
<a href="https://twitter.com/use_bruno" target="_blank" className="flex items-center"> <a href="https://twitter.com/use_bruno" target="_blank" className="flex items-end">
<IconBrandTwitter size={18} strokeWidth={2} /> <IconBrandTwitter size={18} strokeWidth={2} />
<span className="label ml-2">Twitter</span> <span className="label ml-2">Twitter</span>
</a> </a>

View File

@ -40,6 +40,10 @@ const Wrapper = styled.div`
&:hover { &:hover {
background-color: ${(props) => props.theme.dropdown.hoverBg}; background-color: ${(props) => props.theme.dropdown.hoverBg};
} }
&.border-top {
border-top: solid 1px ${(props) => props.theme.dropdown.seperator};
}
} }
} }
} }

View File

@ -65,7 +65,7 @@ const EnvironmentSelector = ({ collection }) => {
> >
<span>No Environment</span> <span>No Environment</span>
</div> </div>
<div className="dropdown-item" style={{ borderTop: 'solid 1px #e7e7e7' }} onClick={() => setOpenSettingsModal(true)}> <div className="dropdown-item border-top" onClick={() => setOpenSettingsModal(true)}>
<div className="pr-2 text-gray-600"> <div className="pr-2 text-gray-600">
<IconSettings size={18} strokeWidth={1.5} /> <IconSettings size={18} strokeWidth={1.5} />
</div> </div>

View File

@ -23,7 +23,7 @@ const ResponseLoadingOverlay = ({ item, collection }) => {
<IconRefresh size={24} className="animate-spin" /> <IconRefresh size={24} className="animate-spin" />
<button <button
onClick={handleCancelRequest} onClick={handleCancelRequest}
className="mt-4 uppercase bg-gray-200 active:bg-blueGray-600 text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150" className="mt-4 uppercase btn-md rounded btn-secondary ease-linear transition-all duration-150"
type="button" type="button"
> >
Cancel Request Cancel Request

View File

@ -3,6 +3,10 @@ import styled from 'styled-components';
const StyledWrapper = styled.div` const StyledWrapper = styled.div`
padding-top: 20%; padding-top: 20%;
width: 100%; width: 100%;
.send-icon {
color: ${(props) => props.theme.requestTabPanel.responseSendIcon};
}
`; `;
export default StyledWrapper; export default StyledWrapper;

View File

@ -5,7 +5,7 @@ import StyledWrapper from './StyledWrapper';
const Placeholder = () => { const Placeholder = () => {
return ( return (
<StyledWrapper> <StyledWrapper>
<div className="text-gray-300 flex justify-center" style={{ fontSize: 200 }}> <div className="send-icon flex justify-center" style={{ fontSize: 200 }}>
<IconSend size={150} strokeWidth={1} /> <IconSend size={150} strokeWidth={1} />
</div> </div>
<div className="flex mt-4"> <div className="flex mt-4">

View File

@ -3,7 +3,7 @@ import styled from 'styled-components';
const Wrapper = styled.div` const Wrapper = styled.div`
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 600; font-weight: 600;
color: rgb(117 117 117); color: ${(props) => props.theme.requestTabPanel.responseStatus};
`; `;
export default Wrapper; export default Wrapper;

View File

@ -3,7 +3,7 @@ import styled from 'styled-components';
const Wrapper = styled.div` const Wrapper = styled.div`
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 600; font-weight: 600;
color: rgb(117 117 117); color: ${(props) => props.theme.requestTabPanel.responseStatus};
`; `;
export default Wrapper; export default Wrapper;

View File

@ -3,6 +3,14 @@ import styled from 'styled-components';
const Wrapper = styled.div` const Wrapper = styled.div`
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 600; font-weight: 600;
&.text-ok {
color: ${(props) => props.theme.requestTabPanel.responseOk};
}
&.text-error {
color: ${(props) => props.theme.requestTabPanel.responseError};
}
`; `;
export default Wrapper; export default Wrapper;

View File

@ -3,19 +3,20 @@ import classnames from 'classnames';
import statusCodePhraseMap from './get-status-code-phrase'; import statusCodePhraseMap from './get-status-code-phrase';
import StyledWrapper from './StyledWrapper'; import StyledWrapper from './StyledWrapper';
// Todo: text-error class is not getting pulled in for 500 errors
const StatusCode = ({ status }) => { const StatusCode = ({ status }) => {
const getTabClassname = () => { const getTabClassname = (status) => {
return classnames('', { return classnames('', {
'text-blue-700': status >= 100 && status < 200, 'text-ok': status >= 100 && status < 200,
'text-green-700': status >= 200 && status < 300, 'text-ok': status >= 200 && status < 300,
'text-purple-700': status >= 300 && status < 400, 'text-error': status >= 300 && status < 400,
'text-yellow-700': status >= 400 && status < 500, 'text-error': status >= 400 && status < 500,
'text-red-700': status >= 500 && status < 600 'text-error': status >= 500 && status < 600
}); });
}; };
return ( return (
<StyledWrapper className={getTabClassname()}> <StyledWrapper className={getTabClassname(status)}>
{status} {statusCodePhraseMap[status]} {status} {statusCodePhraseMap[status]}
</StyledWrapper> </StyledWrapper>
); );

View File

@ -7,7 +7,7 @@ const StyledWrapper = styled.div`
.local-collections-unavailable { .local-collections-unavailable {
padding: 0.35rem 0.6rem; padding: 0.35rem 0.6rem;
border-top: solid 1px #ddd; border-top: solid 1px ${(props) => props.theme.dropdown.seperator};
font-size: 11px; font-size: 11px;
} }
.collection-dropdown { .collection-dropdown {

View File

@ -43,6 +43,7 @@ const darkTheme = {
bg: 'rgb(48, 48, 49)', bg: 'rgb(48, 48, 49)',
hoverBg: '#0F395E', hoverBg: '#0F395E',
shadow: 'rgb(0 0 0 / 36%) 0px 2px 8px', shadow: 'rgb(0 0 0 / 36%) 0px 2px 8px',
seperator: '#444'
}, },
request: { request: {
@ -65,7 +66,11 @@ const darkTheme = {
}, },
bodyModeSelect: { bodyModeSelect: {
color: 'transparent' color: 'transparent'
} },
responseSendIcon: '#555',
responseStatus: '#ccc',
responseOk: '#8cd656',
responseError: '#f06f57'
}, },
collection: { collection: {

View File

@ -43,6 +43,7 @@ const lightTheme = {
bg: '#fff', bg: '#fff',
hoverBg: '#e9e9e9', hoverBg: '#e9e9e9',
shadow: 'rgb(50 50 93 / 25%) 0px 6px 12px -2px, rgb(0 0 0 / 30%) 0px 3px 7px -3px', shadow: 'rgb(50 50 93 / 25%) 0px 6px 12px -2px, rgb(0 0 0 / 30%) 0px 3px 7px -3px',
seperator: '#e7e7e7'
}, },
request: { request: {
@ -65,7 +66,11 @@ const lightTheme = {
}, },
bodyModeSelect: { bodyModeSelect: {
color: '#efefef' color: '#efefef'
} },
responseSendIcon: 'rgb(209, 213, 219)',
responseStatus: 'rgb(117 117 117)',
responseOk: '#047857',
responseError: 'rgb(185, 28, 28)'
}, },
collection: { collection: {