renames client to admin, sets up component library
This commit is contained in:
33
src/admin/components/forms/Submit/index.js
Normal file
33
src/admin/components/forms/Submit/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useForm, useFormProcessing } from '../Form/context';
|
||||
import Button from '../../elements/Button';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
const baseClass = 'form-submit';
|
||||
|
||||
const FormSubmit = ({ children }) => {
|
||||
const processing = useFormProcessing();
|
||||
const { disabled } = useForm();
|
||||
|
||||
return (
|
||||
<div className={baseClass}>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={processing || disabled ? true : undefined}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
FormSubmit.propTypes = {
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
PropTypes.node,
|
||||
]).isRequired,
|
||||
};
|
||||
|
||||
export default FormSubmit;
|
||||
5
src/admin/components/forms/Submit/index.scss
Normal file
5
src/admin/components/forms/Submit/index.scss
Normal file
@@ -0,0 +1,5 @@
|
||||
form > .form-submit {
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user