Skip to content

Commit

Permalink
fix: by default hide cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
SwaySway committed Oct 12, 2022
1 parent 949a0ed commit 80d3990
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
TextField,
} from \\"@aws-amplify/ui-react\\";
export default function CustomDataForm(props) {
const { onSubmit, onCancel, onValidate, onChange, overrides, ...rest } =
const { onCancel, onSubmit, onValidate, onChange, overrides, ...rest } =
props;
const initialValues = {
name: undefined,
Expand Down Expand Up @@ -400,8 +400,8 @@ import {
export default function CustomDataForm(props) {
const {
initialData,
onSubmit,
onCancel,
onSubmit,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -936,7 +936,7 @@ function ArrayField({
);
}
export default function CustomDataForm(props) {
const { onSubmit, onCancel, onValidate, onChange, overrides, ...rest } =
const { onCancel, onSubmit, onValidate, onChange, overrides, ...rest } =
props;
const initialValues = {
name: undefined,
Expand Down Expand Up @@ -1347,7 +1347,6 @@ export default function MyPostForm(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -1474,14 +1473,6 @@ export default function MyPostForm(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -1734,7 +1725,6 @@ export declare type MyPostFormProps = React.PropsWithChildren<{
onSubmit?: (fields: MyPostFormInputValues) => MyPostFormInputValues;
onSuccess?: (fields: MyPostFormInputValues) => void;
onError?: (fields: MyPostFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: MyPostFormInputValues) => MyPostFormInputValues;
onValidate?: MyPostFormValidationValues;
}>;
Expand Down Expand Up @@ -1892,8 +1882,7 @@ function ArrayField({
);
}
export default function NestedJson(props) {
const { onSubmit, onCancel, onValidate, onChange, overrides, ...rest } =
props;
const { onSubmit, onValidate, onChange, overrides, ...rest } = props;
const { tokens } = useTheme();
const initialValues = {
\\"first-Name\\": undefined,
Expand Down Expand Up @@ -2227,14 +2216,6 @@ export default function NestedJson(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -2297,7 +2278,6 @@ export declare type NestedJsonProps = React.PropsWithChildren<{
overrides?: NestedJsonOverridesProps | undefined | null;
} & {
onSubmit: (fields: NestedJsonInputValues) => void;
onCancel?: () => void;
onChange?: (fields: NestedJsonInputValues) => NestedJsonInputValues;
onValidate?: NestedJsonValidationValues;
}>;
Expand Down Expand Up @@ -2456,15 +2436,8 @@ function ArrayField({
);
}
export default function NestedJson(props) {
const {
initialData,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
...rest
} = props;
const { initialData, onSubmit, onValidate, onChange, overrides, ...rest } =
props;
const initialValues = {
firstName: undefined,
\\"last-Name\\": undefined,
Expand Down Expand Up @@ -2712,14 +2685,6 @@ export default function NestedJson(props) {
{...getOverrideProps(overrides, \\"ResetButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -2777,7 +2742,6 @@ export declare type NestedJsonProps = React.PropsWithChildren<{
} & {
initialData?: NestedJsonInputValues;
onSubmit: (fields: NestedJsonInputValues) => void;
onCancel?: () => void;
onChange?: (fields: NestedJsonInputValues) => NestedJsonInputValues;
onValidate?: NestedJsonValidationValues;
}>;
Expand All @@ -2800,8 +2764,7 @@ import {
TextField,
} from \\"@aws-amplify/ui-react\\";
export default function CustomWithSectionalElements(props) {
const { onSubmit, onCancel, onValidate, onChange, overrides, ...rest } =
props;
const { onSubmit, onValidate, onChange, overrides, ...rest } = props;
const initialValues = {
name: undefined,
};
Expand Down Expand Up @@ -2903,14 +2866,6 @@ export default function CustomWithSectionalElements(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -2953,7 +2908,6 @@ export declare type CustomWithSectionalElementsProps = React.PropsWithChildren<{
overrides?: CustomWithSectionalElementsOverridesProps | undefined | null;
} & {
onSubmit: (fields: CustomWithSectionalElementsInputValues) => void;
onCancel?: () => void;
onChange?: (fields: CustomWithSectionalElementsInputValues) => CustomWithSectionalElementsInputValues;
onValidate?: CustomWithSectionalElementsValidationValues;
}>;
Expand Down Expand Up @@ -2981,7 +2935,6 @@ export default function MyPostForm(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -3093,14 +3046,6 @@ export default function MyPostForm(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -3290,7 +3235,6 @@ export declare type MyPostFormProps = React.PropsWithChildren<{
onSubmit?: (fields: MyPostFormInputValues) => MyPostFormInputValues;
onSuccess?: (fields: MyPostFormInputValues) => void;
onError?: (fields: MyPostFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: MyPostFormInputValues) => MyPostFormInputValues;
onValidate?: MyPostFormValidationValues;
}>;
Expand Down Expand Up @@ -3319,7 +3263,6 @@ export default function MyPostForm(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -3449,14 +3392,6 @@ export default function MyPostForm(props) {
{...getOverrideProps(overrides, \\"ResetButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -3651,14 +3586,6 @@ export default function MyPostForm(props) {
{...getOverrideProps(overrides, \\"ResetButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -3718,7 +3645,6 @@ export declare type MyPostFormProps = React.PropsWithChildren<{
onSubmit?: (fields: MyPostFormInputValues) => MyPostFormInputValues;
onSuccess?: (fields: MyPostFormInputValues) => void;
onError?: (fields: MyPostFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: MyPostFormInputValues) => MyPostFormInputValues;
onValidate?: MyPostFormValidationValues;
}>;
Expand Down Expand Up @@ -3746,7 +3672,6 @@ export default function BlogCreateForm(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -3955,14 +3880,6 @@ export default function BlogCreateForm(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -4014,7 +3931,6 @@ export declare type BlogCreateFormProps = React.PropsWithChildren<{
onSubmit?: (fields: BlogCreateFormInputValues) => BlogCreateFormInputValues;
onSuccess?: (fields: BlogCreateFormInputValues) => void;
onError?: (fields: BlogCreateFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: BlogCreateFormInputValues) => BlogCreateFormInputValues;
onValidate?: BlogCreateFormValidationValues;
}>;
Expand Down Expand Up @@ -4182,7 +4098,6 @@ export default function InputGalleryCreateForm(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -4654,14 +4569,6 @@ export default function InputGalleryCreateForm(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -4728,7 +4635,6 @@ export declare type InputGalleryCreateFormProps = React.PropsWithChildren<{
onSubmit?: (fields: InputGalleryCreateFormInputValues) => InputGalleryCreateFormInputValues;
onSuccess?: (fields: InputGalleryCreateFormInputValues) => void;
onError?: (fields: InputGalleryCreateFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: InputGalleryCreateFormInputValues) => InputGalleryCreateFormInputValues;
onValidate?: InputGalleryCreateFormValidationValues;
}>;
Expand Down Expand Up @@ -4897,7 +4803,6 @@ export default function InputGalleryUpdateForm(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -5420,14 +5325,6 @@ export default function InputGalleryUpdateForm(props) {
{...getOverrideProps(overrides, \\"ResetButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -5496,7 +5393,6 @@ export declare type InputGalleryUpdateFormProps = React.PropsWithChildren<{
onSubmit?: (fields: InputGalleryUpdateFormInputValues) => InputGalleryUpdateFormInputValues;
onSuccess?: (fields: InputGalleryUpdateFormInputValues) => void;
onError?: (fields: InputGalleryUpdateFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: InputGalleryUpdateFormInputValues) => InputGalleryUpdateFormInputValues;
onValidate?: InputGalleryUpdateFormValidationValues;
}>;
Expand Down Expand Up @@ -5525,7 +5421,6 @@ export default function PostCreateFormRow(props) {
onSuccess,
onError,
onSubmit,
onCancel,
onValidate,
onChange,
overrides,
Expand Down Expand Up @@ -5827,14 +5722,6 @@ export default function PostCreateFormRow(props) {
{...getOverrideProps(overrides, \\"ClearButton\\")}
></Button>
<Flex {...getOverrideProps(overrides, \\"RightAlignCTASubFlex\\")}>
<Button
children=\\"Cancel\\"
type=\\"button\\"
onClick={() => {
onCancel && onCancel();
}}
{...getOverrideProps(overrides, \\"CancelButton\\")}
></Button>
<Button
children=\\"Submit\\"
type=\\"submit\\"
Expand Down Expand Up @@ -5893,7 +5780,6 @@ export declare type PostCreateFormRowProps = React.PropsWithChildren<{
onSubmit?: (fields: PostCreateFormRowInputValues) => PostCreateFormRowInputValues;
onSuccess?: (fields: PostCreateFormRowInputValues) => void;
onError?: (fields: PostCreateFormRowInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: PostCreateFormRowInputValues) => PostCreateFormRowInputValues;
onValidate?: PostCreateFormRowValidationValues;
}>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exports[`form-render utils should generate before & complete types if datastore
onSubmit?: (fields: mySampleFormInputValues) => mySampleFormInputValues;
onSuccess?: (fields: mySampleFormInputValues) => void;
onError?: (fields: mySampleFormInputValues, errorMessage: string) => void;
onCancel?: () => void;
onChange?: (fields: mySampleFormInputValues) => mySampleFormInputValues;
onValidate?: mySampleFormValidationValues;
}"
Expand All @@ -15,7 +14,6 @@ exports[`form-render utils should generate before & complete types if datastore
exports[`form-render utils should generate regular onsubmit if dataSourceType is custom 1`] = `
"{
onSubmit: (fields: myCustomFormInputValues) => void;
onCancel?: () => void;
onChange?: (fields: myCustomFormInputValues) => myCustomFormInputValues;
onValidate?: myCustomFormValidationValues;
}"
Expand Down
Loading

0 comments on commit 80d3990

Please sign in to comment.