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

Style and structure #28

Closed
wants to merge 5 commits into from
Closed
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
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MediStock</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
17 changes: 16 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"framer-motion": "^6.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.10.0",
"react-icons": "^5.4.0",
"react-router-dom": "^6.28.0",
"styled-components": "^6.1.13"
},
"devDependencies": {
Expand Down
Binary file added public/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

94 changes: 50 additions & 44 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createBrowserRouter, RouterProvider } from 'react-router-dom';

import {
AddDrug,
AdminAddUser,
Alerts,
Dashboard,
Expand All @@ -15,6 +14,9 @@ import {
Error,
EditDrug,
HomeLayout,
AllDrugs,
PastOrders,
AddDrug,
} from './pages';

const router = createBrowserRouter([
Expand All @@ -27,10 +29,6 @@ const router = createBrowserRouter([
index: true,
element: <Landing />,
},
{
path: 'dashboard',
element: <Dashboard />,
},
{
path: 'register',
element: <Register />,
Expand All @@ -39,49 +37,57 @@ const router = createBrowserRouter([
path: 'login',
element: <Login />,
},
{
path: 'dashboard',
element: <Dashboard />,
children: [
{
index: 'true',
element: <AllDrugs />,
},
{
path: 'adduser',
element: <AdminAddUser />,
},
{
path: 'dispense',
element: <DispenseDrug />,
},
{
path: 'alerts',
element: <Alerts />,
},
{
path: 'reports',
element: <Reports />,
},
{
path: 'store',
element: <Store />,
},
{
path: 'user',
element: <User />,
},
{
path: 'edit',
element: <EditDrug updateDrug={EditDrug} />,
},
{
path: 'add',
element: <AddDrug addDrugs={AddDrug} />,
},
{
path: 'past-orders',
element: <PastOrders />,
},
],
},
],
},

{
path: '/alerts',
element: <Alerts />,
},
{
path: '/adddrug',
element: <AddDrug addDrugs={AddDrug} />,
},
{
path: '/editdrug',
element: <EditDrug updateDrug={EditDrug} />,
},
{
path: '/dispense',
element: <DispenseDrug />,
},
{
path: '/store',
element: <Store />,
},
{
path: '/user',
element: <User />,
},
{
path: '/adminuser',
element: <AdminAddUser />,
},
{
path: '/reports',
element: <Reports />,
},
]);

const App = () => {
return (
<>
<RouterProvider router={router} />
</>
);
return <RouterProvider router={router} />;
};

export default App;
1 change: 1 addition & 0 deletions src/assets/not-found.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 21 additions & 28 deletions src/components/AddMedicineForm.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
Expand All @@ -11,23 +10,21 @@ const AddMedicineForm = ({ id, value, handleMedChange, placeholder }) => {
}, [value]);

return (
<div>
<StyleInput
type={
id === 'expirationDate'
? 'date'
: ['quantity', 'minAmount', 'lotNumber', 'ndcNumber'].includes(id)
? 'number'
: 'text'
}
key={id}
id={id}
value={value} // Directly use value passed as a prop
onChange={handleMedChange}
placeholder={placeholder}
ref={inputRef}
/>
</div>
<StyleInput
type={
id === 'expirationDate'
? 'date'
: ['quantity', 'minAmount', 'lotNumber', 'ndcNumber'].includes(id)
? 'number'
: 'text'
}
key={id}
id={id}
value={value} // Directly use value passed as a prop
onChange={handleMedChange}
placeholder={placeholder}
ref={inputRef}
/>
);
};

Expand All @@ -43,20 +40,16 @@ export default AddMedicineForm;
export const FormField = styled.div`
display: flex;
flex-direction: column;
gap: 0.4rem; /* Adjust spacing between label and input */
`;

export const StyleInput = styled.input`
text-size: 1rem;
width: 100%;
border: 1.5px solid #000;
border-radius: 4px;
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 1em;
margin: 0rem;
color: #000;
padding: 0.375rem 0.75rem;
border-radius: var(--border-radius);
border: 1px solid var(--grey-300);
color: black;
height: 35px;
text-transform: uppercase;

/* Placeholder text color */
&::placeholder {
Expand Down
84 changes: 84 additions & 0 deletions src/components/BigSidebar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import styled from 'styled-components';
import Logo from './Logo';
import NavLinks from './NavLinks';
import { useDashboardContext } from '../pages/Dashboard';

const BigSidebar = () => {
const { showSidebar } = useDashboardContext();
return (
<Wrapper>
<div className={showSidebar ? 'sidebar-container' : 'sidebar-container show-sidebar'}>
<div className="content">
<header>
<Logo className="logo" />
</header>
<NavLinks isBigSidebar />
</div>
</div>
</Wrapper>
);
};

export default BigSidebar;

const Wrapper = styled.aside`
display: none;
@media (min-width: 992px) {
display: block;
box-shadow: 1px 0px 0px 0px rgba(0, 0, 0, 0.1);
.sidebar-container {
background: white;
min-height: 100vh;
height: 100%;
width: 250px;
margin-left: -250px;
transition: margin-left 0.3s ease-in-out;
}
.content {
position: sticky;
top: 0;
}
.show-sidebar {
margin-left: 0;
}
header {
height: 6rem;
display: flex;
align-items: center;
justify-content: center;
padding-left: 2rem;
padding-right: 2rem;
}
.nav-links {
padding-top: 2rem;
display: flex;
flex-direction: column;
}
.nav-link {
display: flex;
align-items: center;
color: var(--color-blue-dark);
padding: 1rem 0;
padding-left: 2rem;
text-transform: capitalize;
transition: padding-left 0.3s ease-in-out;
}
.nav-link:hover {
padding-left: 3rem;
color: var(--color-green-light);
transition: var(--transition);
}
.icon {
font-size: 1.5rem;
margin-right: 1rem;
display: grid;
place-items: center;
}
.active {
color: var(--color-green-light);
}
.pending {
background: var(--background-color);
}
}
`;
Loading