Merge branch 'master' of github.cmd.navi-tech.in:navi-infra/deployment-portal-frontend
Conflicts: src/components/manifest/Form.tsx
This commit is contained in:
21
src/components/common/ConfirmationButton.tsx
Normal file
21
src/components/common/ConfirmationButton.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as React from 'react';
|
||||
import { ButtonProps } from '@material-ui/core';
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
const ConfirmationButton = (props: ButtonProps) => {
|
||||
const [isAskingForConfirmation, toggleConfirmation] = React.useState(false);
|
||||
const { className, onClick, ...buttonProps } = props;
|
||||
const askForConfirmation = () => {
|
||||
toggleConfirmation(true);
|
||||
setTimeout(() => toggleConfirmation(false), 3000);
|
||||
};
|
||||
const onConfirmation = (e: any) => {
|
||||
toggleConfirmation(false);
|
||||
onClick!(e);
|
||||
};
|
||||
if (isAskingForConfirmation) {
|
||||
return <Button {...buttonProps} onClick={onConfirmation} className={`secondary-confirmation-button ${className}`} color="secondary" variant="contained">Click to confirm</Button>;
|
||||
}
|
||||
return <Button {...buttonProps} color="secondary" className={className} onClick={askForConfirmation} />;
|
||||
};
|
||||
export default ConfirmationButton;
|
||||
@@ -4,12 +4,12 @@ import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import { createStyles } from "@material-ui/core";
|
||||
import MenuAppBar from "../layout/Header";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
// import "./../components.css";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import { store } from "../../store/store";
|
||||
import { withCookies } from "react-cookie";
|
||||
import SchemaForm from "./SchemaForm";
|
||||
import { toast } from 'react-toastify';
|
||||
import ConfirmationButton from "../common/ConfirmationButton";
|
||||
|
||||
const styles = createStyles({
|
||||
container: {
|
||||
@@ -137,7 +137,7 @@ const Form = (props: any) => {
|
||||
<SchemaForm name="extraResources" />
|
||||
</SchemaForm>
|
||||
|
||||
<Button
|
||||
<ConfirmationButton
|
||||
type="submit"
|
||||
color="primary"
|
||||
variant="contained"
|
||||
@@ -158,26 +158,8 @@ const Form = (props: any) => {
|
||||
}}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</ConfirmationButton>
|
||||
</Grid>
|
||||
{/* <Grid item xs className="flex-col-scroll">
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
marginTop: "1rem",
|
||||
borderRadius: "0.75em",
|
||||
backgroundColor: "#cecece",
|
||||
fontFamily: "verdana",
|
||||
fontSize: 18,
|
||||
}}
|
||||
>
|
||||
<h3>Manifest Data</h3>
|
||||
<pre>{formatDisplayData(standaloneData)}</pre>
|
||||
</div>
|
||||
</Grid> */}
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user