Skip to content

Commit

Permalink
Setting Offcanvas created and functional
Browse files Browse the repository at this point in the history
  • Loading branch information
Delaney H committed Mar 25, 2024
1 parent 702afe6 commit 3675f69
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import App from './pages/App';
import reportWebVitals from './reportWebVitals';
import 'bootstrap/dist/css/bootstrap.min.css';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function App() {
<Route path="/garage/vehicle-history/upload" element={<UploadVehicleHistory />} />
<Route path="/garage/vehicle-history/manual" element={<ManualVehicleHistory />} />

<Route path="/settings" element={<Settings />}/>
<Route path="/." element={<Settings />}/>
</Routes>
</div>
</BrowserRouter>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/Garage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {BrowserRouter, Routes, Route, Link, useNavigate} from "react-router-dom"
import GarageNavbar from "./GarageNavbar";
import AddRemoveNavbar from "./AddRemoveNavbar";
import VehicleInfo from "./VehicleInfo";
import Settings from "./Settings";

function Garage() {
// TODO: REPLACE WITH REAL VALUES, THESE ARE USED AS TEST VALUES
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/NavBar.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {Link} from "react-router-dom";
import Settings from "./Settings";

function NavBar() {
return (
<div>
<Link to="/">Home</Link>
<Link to="/login">Login</Link>
<Link to="/garage">Garage</Link>
<Link to="/settings">Settings</Link>
<Settings />
</div>
);
}
Expand Down
19 changes: 8 additions & 11 deletions frontend/src/pages/Settings.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
import { useState } from 'react';
import ReactDOM from 'react-dom';
import Offcanvas from "react-bootstrap/Offcanvas";
import Button from "react-bootstrap/Button";
import Button from 'react-bootstrap/Button';
import Offcanvas from 'react-bootstrap/Offcanvas';

export const Settings = () => {
const [darkMode, setDarkMode] = useState(false);
const [notifications, setNotifications] = useState(false);
const [unitOfMeasurement, setUnitOfMeasurement] = useState('metric');

const [visibility, setVisibility] = useState(false);
const handleVisibilityChange = () => {
setVisibility(!visibility);
}
const [show, setShow] = useState(false);
const handleShow = () => setShow(!show);

const handleSubmit = (e) => {
e.preventDefault();
}

return (
<div>
<Button variant="primary" onClick={handleVisibilityChange} placement="right">Settings</Button>
<Offcanvas show={visibility}>
<Button variant="primary" onClick={handleShow}>Settings</Button>
<Offcanvas show={show} onHide={handleShow} placement="end">
<Offcanvas.Header closeButton>
<Offcanvas.Title></Offcanvas.Title>
<Offcanvas.Title>Settings</Offcanvas.Title>
</Offcanvas.Header>
<Offcanvas.Body>
<div>
<label>Dark Mode</label>
<label >Dark Mode</label>
<input type="checkbox" checked={darkMode} onChange={(e) => setDarkMode(e.target.checked)}/>
</div>
<div>
Expand Down

0 comments on commit 3675f69

Please sign in to comment.