-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da2c591
commit 18f1997
Showing
10 changed files
with
154 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.MainDialog { | ||
|
||
&-title { | ||
word-wrap: break-word; | ||
font-size: 1.5rem !important; | ||
font-weight: 700 !important; | ||
} | ||
|
||
&-content { | ||
word-wrap: break-word; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Button, Typography } from "@mui/material"; | ||
import Dialog from "@mui/material/Dialog"; | ||
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 { ReactElement } from "react"; | ||
import { useMainDialog } from "../../contexts/MainDialogContext"; | ||
import "./MainDialog.scss"; | ||
|
||
const MainDialog = (): ReactElement => { | ||
const { isOpen, title, content, closeDialog } = useMainDialog(); | ||
|
||
return ( | ||
<Dialog className="MainDialog" open={isOpen} onClose={closeDialog}> | ||
<DialogTitle> | ||
<Typography className="MainDialog-title">{title}</Typography> | ||
</DialogTitle> | ||
|
||
<DialogContent> | ||
<DialogContentText> | ||
<Typography className="MainDialog-content">{content}</Typography> | ||
</DialogContentText> | ||
</DialogContent> | ||
|
||
<DialogActions> | ||
<Button color="primary" variant="contained" onClick={closeDialog}> | ||
OK | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default MainDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const gitHubUrl = "https://github.com/CS3219-AY2425S1/cs3219-ay2425s1-project-g06"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { createContext, ReactNode, useContext, useState } from "react"; | ||
|
||
interface MainDialogContextType { | ||
isOpen: boolean; | ||
title: string; | ||
content: string; | ||
openDialog: () => void; | ||
closeDialog: () => void; | ||
setTitle: (title: string) => void; | ||
setContent: (content: string) => void; | ||
} | ||
|
||
const MainDialogContext = createContext<MainDialogContextType>({ | ||
isOpen: false, | ||
title: "", | ||
content: "", | ||
openDialog: () => {}, | ||
closeDialog: () => {}, | ||
setTitle: () => {}, | ||
setContent: () => {}, | ||
}); | ||
|
||
export const MainDialogContextProvider: React.FC<{ children: ReactNode }> = ({ children }) => { | ||
const [isOpen, setIsOpen] = useState<boolean>(false); | ||
const [title, setTitle] = useState<string>(""); | ||
const [content, setContent] = useState<string>(""); | ||
|
||
const openDialog = () => { | ||
setIsOpen(true); | ||
}; | ||
|
||
const closeDialog = () => { | ||
setIsOpen(false); | ||
}; | ||
|
||
return ( | ||
<MainDialogContext.Provider value={{ isOpen, title, content, openDialog, closeDialog, setTitle, setContent }}> | ||
{children} | ||
</MainDialogContext.Provider> | ||
); | ||
}; | ||
|
||
export const useMainDialog = () => useContext(MainDialogContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters