Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor navbar + reusable button components #13

Merged
merged 15 commits into from
Nov 28, 2024
383 changes: 9 additions & 374 deletions backend/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"dependencies": {
"@supabase/supabase-js": "^2.46.1",
"cors": "^2.8.5",
"dependencies": "^0.0.1",
"dotenv": "^16.4.5",
"express": "^4.21.0",
"jsonwebtoken": "^9.0.2",
Expand Down
366 changes: 21 additions & 345 deletions frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@heroicons/react": "^2.2.0",
"@mui/icons-material": "^6.1.2",
"@mui/material": "^6.1.2",
"@supabase/supabase-js": "^2.45.5",
"axios": "^1.7.7",
"dependencies": "^0.0.1",
"pdfjs-dist": "^4.7.76",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function App() {
const handleClickLogout = async () => {
try {
await logout();
navigate("/home");
navigate("/login");
} catch (e) {
console.log("Failed to logout: " + e.message);
}
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/assets/flow-leaflets-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/src/assets/magnifying-glass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions frontend/src/components/AppBar/AppBar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.app-bar {
display: flex;
box-sizing: border-box;
position: sticky;
top: 0;
left: 0;
height: 120px;
width: 98vw;
padding: 1rem 3rem 1rem 2rem;
justify-content: space-between;
align-items: center;
background-color: #F7FAFF;
z-index: 1000;
}

.logo {
padding: 0px;
height: 85px;
width: 85px;
}

.icon-search-filter-container {
display: flex;
flex-direction: row;
align-items: center;
gap: 100px;
}

.search-filter-container {
display: flex;
flex-direction: row;
gap: 12px;
}

.search-input {
height: 18px;
font-size: 16px;
padding: 12px 20px 12px 40px;
background-color: white;
background-image: url('../../assets/magnifying-glass.svg');
background-position: 10px 10px;
background-repeat: no-repeat;
background-size: 20px 20px;
background-color: #FBFCFE;
border: none;
border-radius: 20px;
box-shadow: 0px 0px 10px #e3e8f2;
}

.app-bar-filter-button {
display: flex;
height: 40px;
flex-direction: row;
justify-content: center;
align-items: center;
color: #2F3C50;
background-color: #FBFCFE;
box-shadow: 0px 0px 10px #e3e8f2;
border-radius: 20px;
gap: 10px;
}

.small-icon-buttons-container {
display: flex;
flex-direction: row;
gap: 12px;
}

.small-icon-button {
display: flex;
height: 48px;
width: 54px;
flex-direction: row;
justify-content: center;
align-items: center;
color: #2F3C50;
background-color: #FBFCFE;
box-shadow: 0px 0px 10px #e3e8f2;
border-radius: 20px;
}

.app-bar-icon {
height: 24px;
width: 24px;
}
34 changes: 34 additions & 0 deletions frontend/src/components/AppBar/AppBar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Logo from "../../assets/flow-leaflets-logo.svg";
import {
AdjustmentsHorizontalIcon,
BellIcon,
UserCircleIcon
} from '@heroicons/react/24/outline';
import "./AppBar.css"

export const AppBar = () => {
return (
<div className="app-bar">
<div className="icon-search-filter-container">
<img src={Logo} className="logo" />
<div className="search-filter-container">
<input type="text" className="search-input" name="search" placeholder="Search..." />
<button className="app-bar-filter-button">
<AdjustmentsHorizontalIcon className="app-bar-icon" />
<p>Filter</p>
</button>
</div>
</div>
<div>
<div className="small-icon-buttons-container">
<button className="small-icon-button">
<BellIcon className="app-bar-icon" />
</button>
<button className="small-icon-button">
<UserCircleIcon className="app-bar-icon" />
</button>
</div>
</div>
</div>
)
}
12 changes: 12 additions & 0 deletions frontend/src/components/Buttons/CLButtons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.primary-variant-button {
color: #F7FAFF;
background-color: #244B94;
border-radius: 20px;
}

.secondary-variant-button {
color: #4F607E;
background-color: #F7FAFF;
border: 1px solid #9AB0E1;
border-radius: 20px;
}
57 changes: 57 additions & 0 deletions frontend/src/components/Buttons/CLButtons.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import "./CLButtons.css"

const DEFAULT_HEIGHT = "54px"
const DEFAULT_WIDTH = "fit-content"
const DEFAULT_ON_CLICK = () => {}

/**
* PRIMARY variant of the clinical logging button.
* Should work out of the box for most use cases (with the exception of onClick which does nothing by default).
* The height and width are customizable if necessary.
*/
export const CLButtonPrimary = ({
children,
height = DEFAULT_HEIGHT,
width = DEFAULT_WIDTH,
onClick = DEFAULT_ON_CLICK
}) => {

return (
<button
className="primary-variant-button"
onClick={onClick}
style={{
height: height,
width: width
}}
>
{children}
</button>
)
}

/**
* SECONDARY variant of the clinical logging button.
* Should work out of the box for most use cases (with the exception of onClick which does nothing by default).
* The height and width are customizable if necessary.
*/
export const CLButtonSecondary = ({
children,
height = DEFAULT_HEIGHT,
width = DEFAULT_WIDTH,
onClick = DEFAULT_ON_CLICK
}) => {

return (
<button
className="secondary-variant-button"
onClick={onClick}
style={{
height: height,
width: width
}}
>
{children}
</button>
)
}
4 changes: 0 additions & 4 deletions frontend/src/components/Buttons/CreateNewLogButton.css

This file was deleted.

23 changes: 0 additions & 23 deletions frontend/src/components/Buttons/CreateNewLogButton.jsx

This file was deleted.

11 changes: 0 additions & 11 deletions frontend/src/components/Buttons/HomeButton.jsx

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/src/components/Buttons/LogHistoryButton.css

This file was deleted.

23 changes: 0 additions & 23 deletions frontend/src/components/Buttons/LogHistoryButton.jsx

This file was deleted.

10 changes: 0 additions & 10 deletions frontend/src/components/Buttons/SignInButton.css

This file was deleted.

20 changes: 0 additions & 20 deletions frontend/src/components/Buttons/SignInButton.jsx

This file was deleted.

10 changes: 0 additions & 10 deletions frontend/src/components/Buttons/SignOutButton.css

This file was deleted.

24 changes: 0 additions & 24 deletions frontend/src/components/Buttons/SignOutButton.jsx

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/src/components/Buttons/SignUpButton.css

This file was deleted.

Loading
Loading