Skip to content

Commit

Permalink
added darkmode for user/device delete
Browse files Browse the repository at this point in the history
  • Loading branch information
T0biii committed Feb 10, 2024
1 parent 941c704 commit 102c14c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions website/src/components/Present.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import { AppState } from '../AppState';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';

Expand All @@ -20,7 +22,14 @@ export function present<T>(content: (close: (result: T) => void) => React.ReactN
}

export function confirm(msg: string): Promise<boolean> {
const darkLightTheme = createTheme({
palette: {
mode: AppState.darkMode ? 'dark' : 'light',
},
});

return present<boolean>((close) => (
<ThemeProvider theme={darkLightTheme}>
<Dialog open={true} onClose={() => close(false)}>
<DialogTitle>Confirm</DialogTitle>
<DialogContent>
Expand All @@ -35,5 +44,6 @@ export function confirm(msg: string): Promise<boolean> {
</Button>
</DialogActions>
</Dialog>
</ThemeProvider>
));
}

0 comments on commit 102c14c

Please sign in to comment.