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

Refactored Pages #17

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added frontend/src/assets/images/LogRectangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/ShopLogBooks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/adult-cardiac-book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/logbooks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/obstetrics-book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/ophthalmology-book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 33 additions & 17 deletions frontend/src/components/Buttons/CLButtons.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import "./CLButtons.css"
import "./CLButtons.css";

const DEFAULT_HEIGHT = "54px"
const DEFAULT_WIDTH = "fit-content"
const DEFAULT_ON_CLICK = () => {}
const DEFAULT_PRIMARY_CLASSNAME = "primary-variant-button";
const DEFAULT_SECONDARY_CLASSNAME = "secondary-variant-button";

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

/**
* PRIMARY variant of the clinical logging button.
Expand All @@ -11,24 +15,30 @@ const DEFAULT_ON_CLICK = () => {}
*/
export const CLButtonPrimary = ({
children,
className,
height = DEFAULT_HEIGHT,
width = DEFAULT_WIDTH,
onClick = DEFAULT_ON_CLICK
type = DEFAULT_TYPE,
onClick = DEFAULT_ON_CLICK,
}) => {
const updatedClassName = className
? DEFAULT_PRIMARY_CLASSNAME + " " + className
: DEFAULT_PRIMARY_CLASSNAME;

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

/**
* SECONDARY variant of the clinical logging button.
Expand All @@ -37,21 +47,27 @@ export const CLButtonPrimary = ({
*/
export const CLButtonSecondary = ({
children,
className,
height = DEFAULT_HEIGHT,
width = DEFAULT_WIDTH,
onClick = DEFAULT_ON_CLICK
type = DEFAULT_TYPE,
onClick = DEFAULT_ON_CLICK,
}) => {

const updatedClassName = className
? DEFAULT_SECONDARY_CLASSNAME + " " + className
: DEFAULT_SECONDARY_CLASSNAME;

return (
<button
className="secondary-variant-button"
<button
className={updatedClassName}
type={type}
onClick={onClick}
style={{
height: height,
width: width
width: width,
}}
>
{children}
</button>
)
}
);
};
142 changes: 142 additions & 0 deletions frontend/src/components/ContentHeader/ContentHeader.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
.content-header {
position: absolute;
left: 230px;
top: 18%;
display: flex;
width: 80%;
justify-content: space-between;
align-items: center;
padding-bottom: 4px;
border-bottom: 1px solid #9AB0E1;
}

.content-header h2 {
font-size: 24px;
font-weight: 600;
color: #1E1E1E;
}

.content-header[data-page="upload-photo"] h2 {
border-bottom: 2px solid #2B4B96;
}

.button-group {
display: flex;
gap: 12px; /* Space between buttons */
align-items: center;
}

.actions-button {
background: white;
color: #000000; /* SECONDARY_COLOR */
border-radius: 20px; /* DEFAULT_BORDER_RADIUS */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
height: 40px;
padding: 0 16px;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
font-size: 15px;
font-weight: 600;
}

.actions-button:hover {
background: #f0f5ff;
}

.add-button {
background: #244B94; /* PRIMARY_BACKGROUND_COLOR */
color: #F7FAFF; /* PRIMARY_COLOR */
border-radius: 20px; /* DEFAULT_BORDER_RADIUS */
width: 120px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
cursor: pointer;
font-size: 15px;
font-weight: 600;
}

.add-book-button:hover {
opacity: 0.9;
}

.plus-icon {
width: 18px;
height: 18px;
}

.down-icon {
width: 18px;
height: 18px;
}

.back-button {
background: none;
border: none;
padding: 0.5rem;
cursor: pointer;
color: #2B4B96;
}

.preview-button {
background: none;
border: none;
padding: 0.5rem;
cursor: pointer;
color: #333333;
font-weight: 400;
font-size: 1.3rem;
display: flex;
align-items: center;
gap: 10px;
flex-direction: row-reverse;
}

.preview-icon {
width: 30px;
height: 30px;
stroke-width: 2;
color: #244B94;
}

.upload-back-icon {
width: 30px;
height: 30px;
stroke-width: 3;
color: #2B4B96;
transition: transform 0.2s ease;
}

.upload-back-icon:hover {
transform: translateX(-5px);
}

.title-wrapper {
display: flex;
justify-content: center;
}

.upload-photo-title {
color: #1E1E1E;
font-size: 1.8rem;
font-weight: 600;
margin: 0;
padding-bottom: 0.5rem;
width: fit-content;
border-bottom: 2px solid #ECEBED;
}

.upload-photo-header {
position: absolute;
left: 230px;
top: 18%;
display: flex;
width: 80%;
justify-content: space-between;
align-items: center;
padding-bottom: 4px;
}
63 changes: 63 additions & 0 deletions frontend/src/components/ContentHeader/ContentHeader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { useLocation, useNavigate } from "react-router-dom";
import {
PlusIcon,
ChevronDownIcon,
ChevronDoubleLeftIcon,
ChevronLeftIcon,
} from "@heroicons/react/24/outline";
import "./ContentHeader.css";

export default function ContentHeader({ onPreviewClick }) {
const location = useLocation();
const navigate = useNavigate();
const isHistory = location.pathname === "/history";
const isUploadPhoto = location.pathname === "/upload-photo";

if (isUploadPhoto) {
return (
<div className="upload-photo-header">
<button className="back-button" onClick={() => navigate("/home")}>
<ChevronLeftIcon className="upload-back-icon" />
</button>
<div className="title-wrapper">
<h2 className="upload-photo-title">Upload Photos</h2>
</div>
<button className="preview-button" onClick={onPreviewClick}>
Preview
<ChevronDoubleLeftIcon className="preview-icon" />
</button>
</div>
);
}

return (
<div className="content-header">
<h2>{isHistory ? "Log History" : "Logbooks"}</h2>
<div className="button-group">
<AddButton
variant={isHistory ? "history" : "logbook"}
onClick={() => {}}
/>
<ActionsButton onClick={() => {}} />
</div>
</div>
);
}

function AddButton({ variant = "logbook", onClick = () => {} }) {
return (
<button onClick={onClick} className="add-button">
{variant === "history" ? "Add Logs" : "Add Book"}
<PlusIcon className="plus-icon" />
</button>
);
}

function ActionsButton({ onClick = () => {} }) {
return (
<button onClick={onClick} className="actions-button">
<span>Actions</span>
<ChevronDownIcon className="down-icon" />
</button>
);
}
19 changes: 19 additions & 0 deletions frontend/src/components/Home/Header/WelcomeSection.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.welcome-section {
position: absolute;
left: 230px;
top: 12%;
display: flex;
align-items: center;
}

.welcome-text {
font-weight: 300;
font-size: 25px;
color: #1e1e1e;
}

.user-name {
font-weight: bold;
font-size: 25px;
color: #1e1e1e;
}
12 changes: 12 additions & 0 deletions frontend/src/components/Home/Header/WelcomeSection.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "./WelcomeSection.css";

export default function WelcomeSection({ firstName }) {
return (
<div className="welcome-section">
<h1>
<span className="welcome-text">Welcome back, </span>
<span className="user-name">{firstName}</span>
</h1>
</div>
);
}
8 changes: 8 additions & 0 deletions frontend/src/components/Home/LeftSection/BottomSection.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.bottom-section {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-top: 30px;
width: 95%;
height: calc(500px - 280px - 24px);
}
12 changes: 12 additions & 0 deletions frontend/src/components/Home/LeftSection/BottomSection.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ShopBooksCard from "./ShopBooksCard";
import RecentActivityCard from "./RecentActivityCard";
import "./BottomSection.css";

export default function BottomSection({ recentActivities }) {
return (
<div className="bottom-section">
<ShopBooksCard />
<RecentActivityCard recentActivities={recentActivities} />
</div>
);
}
31 changes: 31 additions & 0 deletions frontend/src/components/Home/LeftSection/GetStartedCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.get-started-card {
background: white;
border-radius: 30px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
width: 85%;
padding: 20px 30px;
height: 50%;
}

.get-started-card h2 {
font-size: 20px;
font-weight: 600;
margin-top: 0;
color: #2f3c50;
}

.get-started-card p {
color: #3c4049;
font-weight: 400;
text-align: left;
font-size: 14px;
margin-bottom: 16px;
}

.button-stack {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
height: 55%;
}
Loading
Loading