feat: preferences sidebar restructure (#3170)

This commit is contained in:
lohit 2024-09-23 11:32:03 +05:30 committed by GitHub
parent 7107fa37a1
commit 858afdbf03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 53 additions and 34 deletions

View File

@ -39,7 +39,7 @@ const Font = ({ close }) => {
<StyledWrapper> <StyledWrapper>
<div className="flex flex-row gap-2 w-full"> <div className="flex flex-row gap-2 w-full">
<div className="w-4/5"> <div className="w-4/5">
<label className="block font-medium">Code Editor Font</label> <label className="block">Code Editor Font</label>
<input <input
type="text" type="text"
className="block textbox mt-2 w-full" className="block textbox mt-2 w-full"
@ -52,7 +52,7 @@ const Font = ({ close }) => {
/> />
</div> </div>
<div className="w-1/5"> <div className="w-1/5">
<label className="block font-medium">Font Size</label> <label className="block">Font Size</label>
<input <input
type="number" type="number"
className="block textbox mt-2 w-full" className="block textbox mt-2 w-full"

View File

@ -0,0 +1,22 @@
import React from 'react';
import Font from './Font/index';
import Theme from './Theme/index';
const Display = ({ close }) => {
return (
<div className="flex flex-col my-2 gap-10 w-full">
<div className='w-full flex flex-col gap-2'>
<span>
Theme
</span>
<Theme close={close} />
</div>
<div className='h-[1px] bg-[#aaa5] w-full'></div>
<div className='w-fit flex flex-col gap-2'>
<Font close={close} />
</div>
</div>
);
};
export default Display;

View File

@ -100,7 +100,7 @@ const General = ({ close }) => {
return ( return (
<StyledWrapper> <StyledWrapper>
<form className="bruno-form" onSubmit={formik.handleSubmit}> <form className="bruno-form" onSubmit={formik.handleSubmit}>
<div className="flex items-center mt-2"> <div className="flex items-center my-2">
<input <input
id="sslVerification" id="sslVerification"
type="checkbox" type="checkbox"

View File

@ -113,7 +113,7 @@ const ProxySettings = ({ close }) => {
return ( return (
<StyledWrapper> <StyledWrapper>
<form className="bruno-form" onSubmit={formik.handleSubmit}> <form className="bruno-form" onSubmit={formik.handleSubmit}>
<div className="mb-3 flex items-center"> <div className="mb-3 flex items-center mt-2">
<label className="settings-label" htmlFor="protocol"> <label className="settings-label" htmlFor="protocol">
Mode Mode
</label> </label>

View File

@ -2,13 +2,12 @@ import styled from 'styled-components';
const StyledWrapper = styled.div` const StyledWrapper = styled.div`
div.tabs { div.tabs {
margin-top: -0.5rem;
div.tab { div.tab {
padding: 6px 0px; width: 100%;
min-width: 120px;
padding: 7px 10px;
border: none; border: none;
border-bottom: solid 2px transparent; border-bottom: solid 2px transparent;
margin-right: 1.25rem;
color: var(--color-tab-inactive); color: var(--color-tab-inactive);
cursor: pointer; cursor: pointer;
@ -22,8 +21,12 @@ const StyledWrapper = styled.div`
} }
&.active { &.active {
color: ${(props) => props.theme.tabs.active.color} !important; color: ${(props) => props.theme.sidebar.color} !important;
border-bottom: solid 2px ${(props) => props.theme.tabs.active.border} !important; background: ${(props) => props.theme.sidebar.collection.item.bg};
&:hover {
background: ${(props) => props.theme.sidebar.collection.item.bg} !important;
}
} }
} }
} }

View File

@ -3,10 +3,9 @@ import classnames from 'classnames';
import React, { useState } from 'react'; import React, { useState } from 'react';
import Support from './Support'; import Support from './Support';
import General from './General'; import General from './General';
import Font from './Font';
import Theme from './Theme';
import Proxy from './ProxySettings'; import Proxy from './ProxySettings';
import StyledWrapper from './StyledWrapper'; import StyledWrapper from './StyledWrapper';
import Display from './Display/index';
const Preferences = ({ onClose }) => { const Preferences = ({ onClose }) => {
const [tab, setTab] = useState('general'); const [tab, setTab] = useState('general');
@ -27,32 +26,26 @@ const Preferences = ({ onClose }) => {
return <Proxy close={onClose} />; return <Proxy close={onClose} />;
} }
case 'theme': { case 'display': {
return <Theme close={onClose} />; return <Display close={onClose} />;
} }
case 'support': { case 'support': {
return <Support />; return <Support />;
} }
case 'font': {
return <Font close={onClose} />;
}
} }
}; };
return ( return (
<StyledWrapper> <StyledWrapper>
<Modal size="lg" title="Preferences" handleCancel={onClose} hideFooter={true}> <Modal size="lg" title="Preferences" handleCancel={onClose} hideFooter={true}>
<div className="flex items-center px-2 tabs" role="tablist"> <div className='flex flex-row gap-2 mx-[-1rem] !my-[-1.5rem]'>
<div className="flex flex-col items-center tabs" role="tablist">
<div className={getTabClassname('general')} role="tab" onClick={() => setTab('general')}> <div className={getTabClassname('general')} role="tab" onClick={() => setTab('general')}>
General General
</div> </div>
<div className={getTabClassname('theme')} role="tab" onClick={() => setTab('theme')}> <div className={getTabClassname('display')} role="tab" onClick={() => setTab('display')}>
Theme Display
</div>
<div className={getTabClassname('font')} role="tab" onClick={() => setTab('font')}>
Font
</div> </div>
<div className={getTabClassname('proxy')} role="tab" onClick={() => setTab('proxy')}> <div className={getTabClassname('proxy')} role="tab" onClick={() => setTab('proxy')}>
Proxy Proxy
@ -61,7 +54,8 @@ const Preferences = ({ onClose }) => {
Support Support
</div> </div>
</div> </div>
<section className="flex flex-grow px-2 mt-4 tab-panel">{getTabPanel(tab)}</section> <section className="flex flex-grow px-2 pt-2 pb-6 tab-panel">{getTabPanel(tab)}</section>
</div>
</Modal> </Modal>
</StyledWrapper> </StyledWrapper>
); );