Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spacing tokens and use in settings view #7200

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -9,7 +9,7 @@ import { RoutePath } from '../lib/routes';
import { useBoolean } from '../lib/utility-hooks';
import { useSelector } from '../redux/store';
import * as AppButton from './AppButton';
import { measurements, tinyText } from './common-styles';
import { measurements, spacings, tinyText } from './common-styles';
import ErrorView from './ErrorView';
import { Footer } from './Layout';
import { ModalAlert, ModalMessage, ModalMessageList } from './Modal';
Expand All @@ -28,7 +28,7 @@ export default function Launch() {

const StyledFooter = styled(Footer)({
backgroundColor: colors.blue,
padding: `0 14px ${measurements.viewMargin}`,
padding: `0 14px ${spacings.spacing6}`,
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,23 +17,51 @@ 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} &&`]: {
marginBottom: 0,
},
});

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
Loading