Skip to content

Commit

Permalink
Merge branch 'change-to-new-spacings-in-settings-view-des-1454'
Browse files Browse the repository at this point in the history
  • Loading branch information
raksooo committed Nov 28, 2024
2 parents c0667d4 + 8b6311b commit 8f45d95
Show file tree
Hide file tree
Showing 28 changed files with 203 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const AccountRows = styled.div({
});

export const AccountRow = styled.div({
padding: `0 ${measurements.viewMargin}`,
padding: `0 ${measurements.horizontalViewMargin}`,
marginBottom: measurements.rowVerticalMargin,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ import {
import ImageView from './ImageView';
import InfoButton from './InfoButton';
import { BackAction } from './KeyboardNavigation';
import { Layout, SettingsContainer } from './Layout';
import {
Layout,
SettingsContainer,
SettingsContent,
SettingsNavigationScrollbars,
SettingsStack,
} from './Layout';
import { ModalAlert, ModalAlertType } from './Modal';
import {
NavigationBar,
Expand All @@ -32,7 +38,6 @@ import {
TitleBarItem,
} from './NavigationBar';
import SettingsHeader, { HeaderSubTitle, HeaderTitle } from './SettingsHeader';
import { StyledContent, StyledNavigationScrollbars, StyledSettingsContent } from './SettingsStyles';
import { SmallButton, SmallButtonColor, SmallButtonGroup } from './SmallButton';

const StyledContextMenuButton = styled(Cell.Icon)({
Expand Down Expand Up @@ -114,8 +119,8 @@ export default function ApiAccessMethods() {
</NavigationItems>
</NavigationBar>

<StyledNavigationScrollbars fillContainer>
<StyledContent>
<SettingsNavigationScrollbars fillContainer>
<SettingsContent>
<SettingsHeader>
<HeaderTitle>{messages.pgettext('navigation-bar', 'API access')}</HeaderTitle>
<HeaderSubTitle>
Expand All @@ -126,8 +131,8 @@ export default function ApiAccessMethods() {
</HeaderSubTitle>
</SettingsHeader>

<StyledSettingsContent>
<Cell.Group>
<SettingsStack>
<Cell.Group $noMarginBottom>
<ApiAccessMethod
method={methods.direct}
inUse={methods.direct.id === currentMethod?.id}
Expand All @@ -153,9 +158,9 @@ export default function ApiAccessMethods() {
<SmallButtonGroup $noMarginTop>
<SmallButton onClick={navigateToNew}>{messages.gettext('Add')}</SmallButton>
</SmallButtonGroup>
</StyledSettingsContent>
</StyledContent>
</StyledNavigationScrollbars>
</SettingsStack>
</SettingsContent>
</SettingsNavigationScrollbars>
</NavigationContainer>
</SettingsContainer>
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components';
import { useHistory } from '../lib/history';
import { useBoolean } from '../lib/utility-hooks';
import * as AppButton from './AppButton';
import { measurements } from './common-styles';
import { measurements, spacings } from './common-styles';
import { BackAction } from './KeyboardNavigation';
import { Layout, SettingsContainer } from './Layout';
import {
Expand All @@ -24,7 +24,7 @@ const StyledContent = styled.div({
});

const StyledButtonGroup = styled.div({
margin: measurements.viewMargin,
margin: `${spacings.spacing6} ${measurements.horizontalViewMargin}`,
});

export default function Debug() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const StyledBody = styled.div({
display: 'flex',
flexDirection: 'column',
flex: 1,
padding: `0 ${measurements.viewMargin}`,
padding: `0 ${measurements.horizontalViewMargin}`,
});

export const StyledStatusIcon = styled.div({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ import { useLastDefinedValue } from '../lib/utility-hooks';
import { useSelector } from '../redux/store';
import { SettingsForm } from './cell/SettingsForm';
import { BackAction } from './KeyboardNavigation';
import { Layout, SettingsContainer } from './Layout';
import {
Layout,
SettingsContainer,
SettingsContent,
SettingsNavigationScrollbars,
SettingsStack,
} from './Layout';
import { ModalAlert, ModalAlertType } from './Modal';
import { NavigationBar, NavigationContainer, NavigationItems, TitleBarItem } from './NavigationBar';
import { NamedProxyForm } from './ProxyForm';
import SettingsHeader, { HeaderSubTitle, HeaderTitle } from './SettingsHeader';
import { StyledContent, StyledNavigationScrollbars, StyledSettingsContent } from './SettingsStyles';
import { SmallButton } from './SmallButton';

export function EditApiAccessMethod() {
Expand Down Expand Up @@ -102,20 +107,20 @@ function AccessMethodForm() {
</NavigationItems>
</NavigationBar>

<StyledNavigationScrollbars fillContainer>
<StyledContent>
<SettingsNavigationScrollbars fillContainer>
<SettingsContent>
<SettingsHeader>
<HeaderTitle>{title}</HeaderTitle>
<HeaderSubTitle>{subtitle}</HeaderSubTitle>
</SettingsHeader>

<StyledSettingsContent>
<SettingsStack>
{id !== undefined && method === undefined ? (
<span>Failed to open method</span>
) : (
<NamedProxyForm proxy={method} onSave={onSave} onCancel={pop} />
)}
</StyledSettingsContent>
</SettingsStack>

<TestingDialog
name={updatedMethod?.name ?? ''}
Expand All @@ -125,8 +130,8 @@ function AccessMethodForm() {
cancel={resetTestResult}
save={handleDialogSave}
/>
</StyledContent>
</StyledNavigationScrollbars>
</SettingsContent>
</SettingsNavigationScrollbars>
</NavigationContainer>
</SettingsContainer>
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ import { useBoolean } from '../lib/utility-hooks';
import { useSelector } from '../redux/store';
import { SettingsForm } from './cell/SettingsForm';
import { BackAction } from './KeyboardNavigation';
import { Layout, SettingsContainer } from './Layout';
import {
Layout,
SettingsContainer,
SettingsContent,
SettingsNavigationScrollbars,
SettingsStack,
} from './Layout';
import { ModalAlert, ModalAlertType } from './Modal';
import { NavigationBar, NavigationContainer, NavigationItems, TitleBarItem } from './NavigationBar';
import { ProxyForm } from './ProxyForm';
import SettingsHeader, { HeaderTitle } from './SettingsHeader';
import { StyledContent, StyledNavigationScrollbars, StyledSettingsContent } from './SettingsStyles';
import { SmallButton, SmallButtonColor } from './SmallButton';

export function EditCustomBridge() {
Expand Down Expand Up @@ -73,20 +78,20 @@ function CustomBridgeForm() {
</NavigationItems>
</NavigationBar>

<StyledNavigationScrollbars fillContainer>
<StyledContent>
<SettingsNavigationScrollbars fillContainer>
<SettingsContent>
<SettingsHeader>
<HeaderTitle>{title}</HeaderTitle>
</SettingsHeader>

<StyledSettingsContent>
<SettingsStack>
<ProxyForm
proxy={bridgeSettings.custom}
onSave={onSave}
onCancel={pop}
onDelete={bridgeSettings.custom === undefined ? undefined : showDeleteDialog}
/>
</StyledSettingsContent>
</SettingsStack>

<ModalAlert
isOpen={deleteDialogVisible}
Expand All @@ -110,8 +115,8 @@ function CustomBridgeForm() {
'Deleting the custom bridge will take you back to the select location view and the Automatic option will be selected instead.',
)}
/>
</StyledContent>
</StyledNavigationScrollbars>
</SettingsContent>
</SettingsNavigationScrollbars>
</NavigationContainer>
</SettingsContainer>
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Subtitle = styled.span({
fontFamily: 'Open Sans',
fontSize: '14px',
lineHeight: '20px',
margin: `0 ${measurements.viewMargin}`,
margin: `0 ${measurements.horizontalViewMargin}`,
color: colors.white40,
textAlign: 'center',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const StyledBody = styled.div({
display: 'flex',
flexDirection: 'column',
flex: 1,
padding: `0 ${measurements.viewMargin}`,
padding: `0 ${measurements.horizontalViewMargin}`,
paddingBottom: 'auto',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const StyledBody = styled.div({
display: 'flex',
flexDirection: 'column',
flex: 1,
padding: `0 ${measurements.viewMargin}`,
padding: `0 ${measurements.horizontalViewMargin}`,
});

export const StyledTitle = styled.span(hugeText, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import * as AppButton from './AppButton';
import { measurements, tinyText } from './common-styles';
import ErrorView from './ErrorView';
import { Footer } from './Layout';
import { ModalAlert, ModalMessage, ModalMessageList } from './Modal';
import { ModalAlertType } from './Modal';
import { ModalAlert, ModalAlertType, ModalMessage, ModalMessageList } from './Modal';

export default function Launch() {
const daemonAllowed = useSelector((state) => state.userInterface.daemonAllowed);
Expand All @@ -28,7 +27,6 @@ export default function Launch() {

const StyledFooter = styled(Footer)({
backgroundColor: colors.blue,
padding: `0 14px ${measurements.viewMargin}`,
transition: 'opacity 250ms ease-in-out',
});

Expand Down
43 changes: 36 additions & 7 deletions desktop/packages/mullvad-vpn/src/renderer/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import styled from 'styled-components';

import { colors } from '../../config.json';
import { measurements } from './common-styles';
import { measurements, spacings } from './common-styles';
import HeaderBar from './HeaderBar';
import { NavigationScrollbars } from './NavigationBar';

export const Header = styled(HeaderBar)({
flex: 0,
Expand All @@ -16,27 +17,55 @@ export const Container = styled.div({
overflow: 'hidden',
});

export const Layout = styled.div({
display: 'flex',
flexDirection: 'column',
flex: 1,
height: '100vh',
});

export const SettingsContainer = styled(Container)({
backgroundColor: colors.darkBlue,
});

export const Layout = styled.div({
export const SettingsNavigationScrollbars = styled(NavigationScrollbars)({
flex: 1,
});

export const SettingsContent = styled.div({
display: 'flex',
flexDirection: 'column',
flex: 1,
height: '100vh',
overflow: 'visible',
marginBottom: measurements.verticalViewMargin,
});

export const SettingsStack = styled.div({
display: 'flex',
flexDirection: 'column',
gap: spacings.spacing5,
});

export const Footer = styled.div({
display: 'flex',
flexDirection: 'column',
flex: 0,
paddingTop: '18px',
paddingLeft: measurements.viewMargin,
paddingRight: measurements.viewMargin,
paddingBottom: measurements.viewMargin,
padding: `${spacings.spacing6} ${measurements.horizontalViewMargin} ${measurements.verticalViewMargin}`,
[`${SettingsContent} &&`]: {
paddingBottom: 0,
},
});

export const Spacing = styled.div<{ height: string }>((props) => ({
height: props.height,
}));

export const ButtonStack = styled.div({
display: 'flex',
flexDirection: 'column',
gap: spacings.spacing5,
margin: `0 ${spacings.spacing6}`,
[`${Footer} &&`]: {
margin: `0 ${spacings.spacing3}`,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const StyledLoginForm = styled.div({
flex: '0 1 225px',
flexDirection: 'column',
overflow: 'visible',
padding: `0 ${measurements.viewMargin}`,
padding: `0 ${measurements.horizontalViewMargin}`,
});

interface IStyledAccountInputGroupProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const StyledForm = styled.div({
display: 'flex',
flex: 1,
flexDirection: 'column',
margin: `0 ${measurements.viewMargin}`,
margin: `0 ${measurements.horizontalViewMargin}`,
});

export const StyledFormEmailRow = styled.div({
Expand Down
Loading

0 comments on commit 8f45d95

Please sign in to comment.