Skip to content

Commit

Permalink
Fix spacing in proxy form
Browse files Browse the repository at this point in the history
  • Loading branch information
olmoh committed Dec 18, 2024
1 parent c6bdff0 commit 8ce81ea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ import { useLastDefinedValue } from '../lib/utility-hooks';
import { useSelector } from '../redux/store';
import { SettingsForm } from './cell/SettingsForm';
import { BackAction } from './KeyboardNavigation';
import {
Layout,
SettingsContainer,
SettingsContent,
SettingsNavigationScrollbars,
SettingsStack,
} from './Layout';
import { Layout, SettingsContainer, SettingsContent, SettingsNavigationScrollbars } from './Layout';
import { ModalAlert, ModalAlertType } from './Modal';
import { NavigationBar, NavigationContainer, NavigationItems, TitleBarItem } from './NavigationBar';
import { NamedProxyForm } from './ProxyForm';
Expand Down Expand Up @@ -114,13 +108,11 @@ function AccessMethodForm() {
<HeaderSubTitle>{subtitle}</HeaderSubTitle>
</SettingsHeader>

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

<TestingDialog
name={updatedMethod?.name ?? ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ import { useBoolean } from '../lib/utility-hooks';
import { useSelector } from '../redux/store';
import { SettingsForm } from './cell/SettingsForm';
import { BackAction } from './KeyboardNavigation';
import {
Layout,
SettingsContainer,
SettingsContent,
SettingsNavigationScrollbars,
SettingsStack,
} from './Layout';
import { Layout, SettingsContainer, SettingsContent, SettingsNavigationScrollbars } from './Layout';
import { ModalAlert, ModalAlertType } from './Modal';
import { NavigationBar, NavigationContainer, NavigationItems, TitleBarItem } from './NavigationBar';
import { ProxyForm } from './ProxyForm';
Expand Down Expand Up @@ -84,14 +78,12 @@ function CustomBridgeForm() {
<HeaderTitle>{title}</HeaderTitle>
</SettingsHeader>

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

<ModalAlert
isOpen={deleteDialogVisible}
Expand Down
17 changes: 13 additions & 4 deletions desktop/packages/mullvad-vpn/src/renderer/components/ProxyForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import React from 'react';
import styled from 'styled-components';

import {
CustomProxy,
Expand Down Expand Up @@ -156,6 +157,12 @@ interface ProxyFormButtonsProps {
new: boolean;
}

// TODO: Temporary fix, should be replaced with a flex or shared component
const ActionGroup = styled.div({
display: 'flex',
gap: '12px',
});

export function ProxyFormButtons(props: ProxyFormButtonsProps) {
const { onSave, onCancel, onDelete } = useContext(proxyFormContext);

Expand All @@ -171,10 +178,12 @@ export function ProxyFormButtons(props: ProxyFormButtonsProps) {
</SmallButton>
</SmallButtonGroupStart>
)}
<SmallButton onClick={onCancel}>{messages.gettext('Cancel')}</SmallButton>
<SmallButton onClick={onSave} disabled={!formSubmittable}>
{props.new ? messages.gettext('Add') : messages.gettext('Save')}
</SmallButton>
<ActionGroup>
<SmallButton onClick={onCancel}>{messages.gettext('Cancel')}</SmallButton>
<SmallButton onClick={onSave} disabled={!formSubmittable}>
{props.new ? messages.gettext('Add') : messages.gettext('Save')}
</SmallButton>
</ActionGroup>
</SmallButtonGroup>
);
}
Expand Down

0 comments on commit 8ce81ea

Please sign in to comment.