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

Fix spacing in proxy form #7362

Merged
merged 1 commit into from
Dec 23, 2024
Merged
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,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
Loading