Skip to content
Snippets Groups Projects
Commit 7db9671e authored by danieldeng2's avatar danieldeng2
Browse files

Add basic settings modal

parent cfbd0be4
No related branches found
No related tags found
No related merge requests found
...@@ -58,3 +58,7 @@ code { ...@@ -58,3 +58,7 @@ code {
border-color: #fff; border-color: #fff;
color: #000; color: #000;
} }
.modal-backdrop{
z-index: 9000;
}
...@@ -11,17 +11,23 @@ import { ...@@ -11,17 +11,23 @@ import {
import StandardView from "./pages/StandardView"; import StandardView from "./pages/StandardView";
import { Switch, Route } from "react-router-dom"; import { Switch, Route } from "react-router-dom";
import SignIn from "./pages/SignIn"; import SignIn from "./pages/SignIn";
import SettingsModal from "./pages/SettingsModal";
type AppState = { type AppState = {
toggledLeft: boolean; toggledLeft: boolean;
toggledRight: boolean; toggledRight: boolean;
showSettings: boolean;
}; };
class App extends React.Component<{}, AppState> { class App extends React.Component<{}, AppState> {
width = window.innerWidth; width = window.innerWidth;
constructor(props: {}) { constructor(props: {}) {
super(props); super(props);
this.state = { toggledLeft: false, toggledRight: false }; this.state = {
toggledLeft: false,
toggledRight: false,
showSettings: false,
};
} }
componentDidMount() { componentDidMount() {
...@@ -85,6 +91,11 @@ class App extends React.Component<{}, AppState> { ...@@ -85,6 +91,11 @@ class App extends React.Component<{}, AppState> {
return ( return (
<> <>
<SettingsModal
show={this.state.showSettings}
onHide={() => this.setState({ showSettings: false })}
/>
<Switch> <Switch>
<Route path="/signin"> <Route path="/signin">
<SignIn /> <SignIn />
...@@ -105,6 +116,7 @@ class App extends React.Component<{}, AppState> { ...@@ -105,6 +116,7 @@ class App extends React.Component<{}, AppState> {
<StandardView <StandardView
pages={horizontalBarPages} pages={horizontalBarPages}
onSettingsClick={() => this.setState({ showSettings: true })}
toggledLeft={this.state.toggledLeft} toggledLeft={this.state.toggledLeft}
toggledRight={this.state.toggledRight} toggledRight={this.state.toggledRight}
onOverlayClick={(e) => { onOverlayClick={(e) => {
......
...@@ -3,14 +3,19 @@ import styles from "./style.module.scss"; ...@@ -3,14 +3,19 @@ import styles from "./style.module.scss";
import CalendarGroup from "components/molecules/CalendarGroup"; import CalendarGroup from "components/molecules/CalendarGroup";
import SideBarTabGroup from "components/molecules/SideBarTabGroup"; import SideBarTabGroup from "components/molecules/SideBarTabGroup";
import { faCog, faSignOutAlt } from "@fortawesome/free-solid-svg-icons"; import { faCog, faSignOutAlt } from "@fortawesome/free-solid-svg-icons";
export interface RightBarState { export interface RightBarState {
date: Date; date: Date;
} }
class RightBar extends React.Component<{}, RightBarState> { export interface RightBarProps {
onSettingsClick: (event: React.MouseEvent) => void;
}
class RightBar extends React.Component<RightBarProps, RightBarState> {
private timerID: number = 0; private timerID: number = 0;
constructor(props: {}) { constructor(props: RightBarProps) {
super(props); super(props);
this.state = { date: new Date() }; this.state = { date: new Date() };
} }
...@@ -33,7 +38,8 @@ class RightBar extends React.Component<{}, RightBarState> { ...@@ -33,7 +38,8 @@ class RightBar extends React.Component<{}, RightBarState> {
let buttons = [ let buttons = [
{ {
title: "Settings", title: "Settings",
icon: faCog, icon: faCog,
onClick: this.props.onSettingsClick,
}, },
{ {
title: "Sign Out", title: "Sign Out",
......
import React from "react";
import Modal from "react-bootstrap/Modal";
interface Props {
show: boolean;
onHide: any;
}
const SettingsModal: React.FC<Props> = ({ show, onHide }) => {
return (
<Modal style={{ zIndex: "10000" }} show={show} onHide={onHide}>
<Modal.Header closeButton>
<Modal.Title>Settings</Modal.Title>
</Modal.Header>
<Modal.Body>Woohoo, you're reading this settings in a modal!</Modal.Body>
</Modal>
);
};
export default SettingsModal;
...@@ -28,13 +28,15 @@ interface StandardViewProps { ...@@ -28,13 +28,15 @@ interface StandardViewProps {
}[]; }[];
toggledLeft: boolean; toggledLeft: boolean;
toggledRight: boolean; toggledRight: boolean;
onOverlayClick: (event: React.MouseEvent<HTMLElement>) => void; onOverlayClick: (event: React.MouseEvent<HTMLElement>) => void;
onSettingsClick: (event: React.MouseEvent) => void;
} }
const StandardView: React.FC<StandardViewProps> = ({ const StandardView: React.FC<StandardViewProps> = ({
toggledLeft, toggledLeft,
toggledRight, toggledRight,
onOverlayClick, onOverlayClick,
onSettingsClick,
}: StandardViewProps) => { }: StandardViewProps) => {
const [modulesFilter, setModulesFilter] = useState("In Progress"); const [modulesFilter, setModulesFilter] = useState("In Progress");
...@@ -132,7 +134,7 @@ const StandardView: React.FC<StandardViewProps> = ({ ...@@ -132,7 +134,7 @@ const StandardView: React.FC<StandardViewProps> = ({
<Route path="/" render={() => <Redirect to="/dashboard" />} /> <Route path="/" render={() => <Redirect to="/dashboard" />} />
</Switch> </Switch>
</Container> </Container>
<RightBar /> <RightBar onSettingsClick={onSettingsClick} />
</div> </div>
); );
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment