File size: 1,605 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Dialog, ExternalLink } from '@automattic/components';
import { createInterpolateElement } from '@wordpress/element';
import { useI18n } from '@wordpress/react-i18n';
import { ComponentProps } from 'react';
import FormattedHeader from 'calypso/components/formatted-header';
import { GitHubBrowseRepositories } from '../components/repositories/browse-repositories';

import './style.scss';

interface DeleteDeploymentDialogProps {
	isVisible: boolean;
	onChange: ComponentProps< typeof GitHubBrowseRepositories >[ 'onSelectRepository' ];
	onClose(): void;
}

export const RepositorySelectionDialog = ( {
	isVisible,
	onChange,
	onClose,
}: DeleteDeploymentDialogProps ) => {
	const { __ } = useI18n();

	return (
		<Dialog
			showCloseIcon
			isVisible={ isVisible }
			shouldCloseOnOverlayClick
			shouldCloseOnEsc
			onClose={ onClose }
			additionalClassNames="github-deployments-dialog"
			className="repository-selection-dialog"
		>
			<div
				css={ {
					display: 'flex',
					flexDirection: 'column',
					flexGrow: 1,
				} }
			>
				<FormattedHeader
					align="left"
					headerText={ __( 'Select repository' ) }
					subHeaderText={ createInterpolateElement(
						__( 'Pick an existing repository or <docsLink>create a new one</docsLink>.' ),
						{
							docsLink: (
								<ExternalLink
									href="https://developer.wordpress.com/docs/developer-tools/github-deployments/create-github-deployment-source-files/"
									target="_blank"
								/>
							),
						}
					) }
				/>
				<GitHubBrowseRepositories onSelectRepository={ onChange } />
			</div>
		</Dialog>
	);
};