UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

110 lines (108 loc) 3.96 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react'; import { makeStyles } from 'tss-react/mui'; import GitAuthForm from '../GitAuthForm'; import Grid from '@mui/material/Grid'; import TextField from '@mui/material/TextField'; import { FormattedMessage } from 'react-intl'; const useStyles = makeStyles()(() => ({ gitInfo: { width: '100%', '& .MuiGrid-item': { padding: '12px' } } })); export function NewRemoteRepositoryForm(props) { const { classes } = useStyles(); const { inputs, setInputs } = props; const handleInputChange = (e) => { setInputs({ [e.target.name]: e.target.value }); }; return React.createElement( Grid, { container: true, spacing: 0, className: classes.gitInfo }, React.createElement( Grid, { item: true, xs: 12 }, React.createElement(TextField, { id: 'remoteName', name: 'remoteName', label: React.createElement(FormattedMessage, { id: 'repositories.remoteName', defaultMessage: 'Remote Git Repository Name' }), InputLabelProps: { shrink: true }, required: true, placeholder: 'origin', autoFocus: true, fullWidth: true, onChange: handleInputChange, value: inputs.remoteName, error: inputs.submitted && !inputs.remoteName, helperText: React.createElement(FormattedMessage, { id: 'repositories.repoRemoteNameHelper', defaultMessage: 'Name the remote that will refer to the source repo to pull from.' }) }) ), React.createElement( Grid, { item: true, xs: 12 }, React.createElement(TextField, { id: 'remoteUrl', name: 'remoteUrl', label: React.createElement(FormattedMessage, { id: 'repositories.remoteUrl', defaultMessage: 'Remote Repository URL' }), InputLabelProps: { shrink: true }, required: true, fullWidth: true, placeholder: 'e.g. https://github.com/craftercms/craftercms-react-blueprint.git', onChange: handleInputChange, value: inputs.remoteUrl, error: inputs.submitted && !inputs.remoteUrl, helperText: React.createElement(FormattedMessage, { id: 'repositories.repoRemoteUrlHelper', defaultMessage: 'The git repository URL to create from.' }) }) ), React.createElement( Grid, { item: true, xs: 12 }, React.createElement(GitAuthForm, { inputs: inputs, setInputs: setInputs, handleInputChange: handleInputChange }) ) ); } export default NewRemoteRepositoryForm;