forked from cerc-io/snowballtools-base
♻️ refactor: create disconnect repository dialog component
This commit is contained in:
parent
4c936b1eb7
commit
e4fdae3329
@ -0,0 +1,30 @@
|
|||||||
|
import ConfirmDialog, {
|
||||||
|
ConfirmDialogProps,
|
||||||
|
} from 'components/shared/ConfirmDialog';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface DisconnectRepositoryDialogProps extends ConfirmDialogProps {}
|
||||||
|
|
||||||
|
export const DisconnectRepositoryDialog = ({
|
||||||
|
open,
|
||||||
|
handleCancel,
|
||||||
|
handleConfirm,
|
||||||
|
...props
|
||||||
|
}: DisconnectRepositoryDialogProps) => {
|
||||||
|
return (
|
||||||
|
<ConfirmDialog
|
||||||
|
{...props}
|
||||||
|
dialogTitle="Disconnect repository?"
|
||||||
|
handleCancel={handleCancel}
|
||||||
|
open={open}
|
||||||
|
confirmButtonTitle="Yes, confirm disconnect"
|
||||||
|
handleConfirm={handleConfirm}
|
||||||
|
confirmButtonProps={{ variant: 'danger' }}
|
||||||
|
>
|
||||||
|
<p className="text-sm text-elements-high-em">
|
||||||
|
Any data tied to your Git project may become misconfigured. Are you sure
|
||||||
|
you want to continue?
|
||||||
|
</p>
|
||||||
|
</ConfirmDialog>
|
||||||
|
);
|
||||||
|
};
|
@ -2,8 +2,8 @@ import React, { useState } from 'react';
|
|||||||
|
|
||||||
import { Button, Typography } from '@material-tailwind/react';
|
import { Button, Typography } from '@material-tailwind/react';
|
||||||
|
|
||||||
import { GitRepositoryDetails } from '../../../../types';
|
import { GitRepositoryDetails } from 'types';
|
||||||
import ConfirmDialog from '../../../shared/ConfirmDialog';
|
import { DisconnectRepositoryDialog } from 'components/projects/Dialog/DisconnectRepositoryDialog';
|
||||||
|
|
||||||
const RepoConnectedSection = ({
|
const RepoConnectedSection = ({
|
||||||
linkedRepo,
|
linkedRepo,
|
||||||
@ -34,21 +34,13 @@ const RepoConnectedSection = ({
|
|||||||
^ Disconnect
|
^ Disconnect
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<ConfirmDialog
|
<DisconnectRepositoryDialog
|
||||||
dialogTitle="Disconnect repository?"
|
handleCancel={() => setDisconnectRepoDialogOpen((preVal) => !preVal)}
|
||||||
handleOpen={() => setDisconnectRepoDialogOpen((preVal) => !preVal)}
|
|
||||||
open={disconnectRepoDialogOpen}
|
open={disconnectRepoDialogOpen}
|
||||||
confirmButtonTitle="Yes, confirm disconnect"
|
|
||||||
handleConfirm={() => {
|
handleConfirm={() => {
|
||||||
setDisconnectRepoDialogOpen((preVal) => !preVal);
|
setDisconnectRepoDialogOpen((preVal) => !preVal);
|
||||||
}}
|
}}
|
||||||
color="red"
|
/>
|
||||||
>
|
|
||||||
<Typography variant="small" placeholder={''}>
|
|
||||||
Any data tied to your Git project may become misconfigured. Are you
|
|
||||||
sure you want to continue?
|
|
||||||
</Typography>
|
|
||||||
</ConfirmDialog>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user