mirror of
https://git.netzspielplatz.de/docker-multiarch/openwrt-firmware-selector.git
synced 2025-11-08 23:39:37 +00:00
Rewrite using typescript, integrate the latest changes from @mwarning/openwrt-firmware-selector
This commit is contained in:
parent
d5c4ea592a
commit
ce4c36622b
47 changed files with 5269 additions and 5282 deletions
57
src/components/AlertDialog.tsx
Normal file
57
src/components/AlertDialog.tsx
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
} from '@material-ui/core';
|
||||
|
||||
type Props = {
|
||||
open: boolean;
|
||||
cancelHandler: () => void;
|
||||
acceptHandler: () => void;
|
||||
body: React.ReactElement;
|
||||
title: React.ReactElement;
|
||||
cancelComponent: React.ReactElement;
|
||||
acceptComponent: React.ReactElement;
|
||||
};
|
||||
|
||||
const AlertDialog: FunctionComponent<Props> = ({
|
||||
open,
|
||||
cancelHandler,
|
||||
acceptHandler,
|
||||
body,
|
||||
title,
|
||||
cancelComponent,
|
||||
acceptComponent,
|
||||
}) => {
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={cancelHandler}
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description"
|
||||
>
|
||||
<DialogTitle id="alert-dialog-title">{title}</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-description">{body}</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
{acceptHandler && (
|
||||
<Button onClick={acceptHandler} color="primary">
|
||||
{acceptComponent}
|
||||
</Button>
|
||||
)}
|
||||
{cancelHandler && (
|
||||
<Button onClick={cancelHandler} color="secondary" variant="contained" autoFocus>
|
||||
{cancelComponent}
|
||||
</Button>
|
||||
)}
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default AlertDialog;
|
||||
Loading…
Add table
Add a link
Reference in a new issue