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

Issue # 56. Designing responsive list component for the list page #67

Merged
merged 28 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
566bd0b
style: listitem name and checkbox colors
eternalmaha Oct 8, 2024
ac390b5
style: layout of list items
eternalmaha Oct 9, 2024
d708574
style: styling the list item component and layout
eternalmaha Oct 10, 2024
fa4ebea
style: aligning filterlist form label with its form control
eternalmaha Oct 10, 2024
6640516
style: font sizing and margins of list items
eternalmaha Oct 11, 2024
348974e
layout: adding React col, row, container components
eternalmaha Oct 11, 2024
fff0edf
layout: adjusted grid layout to better suit list items
eternalmaha Oct 12, 2024
882d546
fix: list items no longer overflow their parent
eternalmaha Oct 12, 2024
34cfb7b
style: imported and added react icons to itemquantity edits
eternalmaha Oct 13, 2024
9e37b04
refactor: using flexbox instead of bootstrap grid for layout
eternalmaha Oct 13, 2024
ead409b
style: align delete button below edit button on small screen sizes
eternalmaha Oct 13, 2024
f76004b
adding additem, sharelist into list page view
eternalmaha Oct 17, 2024
df827f3
style: stlying the add item form inside the listpage
eternalmaha Oct 17, 2024
10a5d95
style: listpage layouting
eternalmaha Oct 17, 2024
ea845fb
fix: mobile responsive
eternalmaha Oct 17, 2024
6cfaca2
refactor: scrolling back up to top of listpage view when at bottom of…
eternalmaha Oct 17, 2024
e1ce2a0
style: cleaning up button sizing
eternalmaha Oct 17, 2024
d0a4684
style: updated urgency status to reflect urgency with color codes
eternalmaha Oct 18, 2024
6844c90
style: improved visibility of filterlist text upon scrolling
eternalmaha Oct 18, 2024
52db7a1
refactor: listpage to excluse additem form and refactor sharelist for…
eternalmaha Oct 18, 2024
b998305
refactor: disregard additem navigation logic
eternalmaha Oct 18, 2024
6d8843b
Merge branch 'main' into ma/designing-responsive-listview
eternalmaha Oct 18, 2024
d1a41de
fix: resolve merge conflict in list page
eternalmaha Oct 18, 2024
1a8a0e8
refactor: removing unnecessary css in list page style page
eternalmaha Oct 18, 2024
f89fc80
making adjustments to use RB 1 Container on list, adjust classes on e…
bbland1 Oct 18, 2024
cfc6a8e
fix: adjusted font-sizes and listitem inputs to be more responsive at…
eternalmaha Oct 19, 2024
430e5e2
style: center view list button
eternalmaha Oct 19, 2024
e56ab5c
refactor: remove managelist navbar button as no longer necessart
eternalmaha Oct 19, 2024
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
9 changes: 9 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"react-bootstrap": "^2.10.5",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
"react-icons": "^5.3.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YASSSSS! I love the use of icons while keeping the button colors the same for smaller screen sizes!

"react-router-dom": "^6.26.2"
},
"devDependencies": {
Expand Down
11 changes: 7 additions & 4 deletions src/components/FilterListInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export function FilterListInput({
};

return (
<Form onSubmit={handleSubmit}>
<InputGroup>
<Form.Label htmlFor="filterList">Filter List:</Form.Label>
<Form className="w-100 w-lg-auto" onSubmit={handleSubmit}>
<InputGroup className="d-flex align-items-center mt-1">
<Form.Label htmlFor="filterList" className="me-2 mb-0">
<span className="fw-bold">Filter List:</span>
</Form.Label>
<Form.Control
type="text"
onChange={handleChange}
Expand All @@ -37,8 +39,9 @@ export function FilterListInput({
placeholder="Search items..."
/>
<Button className="custom-button" onClick={handleClear}>
x
Clear
</Button>

</InputGroup>
</Form>
);
Expand Down
67 changes: 59 additions & 8 deletions src/components/ListItem.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,66 @@
.ListItem {
@import "../styles/_variables";

.ListItemBox {
align-items: baseline;
display: flex;
flex-direction: row;
font-size: 1.2em;
font-size: 1.5em;
justify-content: space-between;
background-color: $primary-blue;
color: $primary-beige;
border-radius: 4px;
max-width: 100%;
box-sizing: border-box;
}

.UrgencyStatus {
display: block;
background-color: $secondary-blue;
color: $primary-beige;
font-size: 1.25em;
max-width: 50%;
width: 80%;
border-radius: 4px;

// Default styles for urgency status
font-weight: bold;

&.inactive {
color: gray;
}

&.overdue {
color: red;
}

&.soon {
color: orange;
}

&.kind-of-soon {
color: yellow;
}

&.not-soon {
color: green;
}
}

.DeleteButton {
width: fit-content;
}

.ListItem-checkbox {
accent-color: var(--color-accent);
.custom-borders {
border: 2px solid $secondary-blue !important;
border-radius: 4px !important;
padding: 20px;
margin-top: 20px;
position: relative;
}

.ListItem-label {
margin-left: 0.2em;
@media (max-width: 576px) {
.EditItem {
flex-direction: column;
}
.PurchaseItem {
font-size: 0.75em;
}
}
55 changes: 37 additions & 18 deletions src/components/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { moreThan24HoursPassed, getDaysBetweenDates } from "../utils";
import { ItemQuantityForm } from "./forms/ItemQuantityForm";
import Button from "react-bootstrap/Button";
import Form from "react-bootstrap/Form";
import { MdOutlineDeleteForever } from "react-icons/md";

interface Props {
item: ListItem;
Expand Down Expand Up @@ -63,6 +64,8 @@ export function ListItemCheckBox({ item, listPath }: Props) {
return "kind of soon";
};

const urgencyStatus = getUrgencyStatus(item);

const handleCheckChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
const newCheckedState = e.target.checked;

Expand Down Expand Up @@ -119,25 +122,41 @@ export function ListItemCheckBox({ item, listPath }: Props) {
};

return (
<div className="ListItem">
<Form.Check
type="checkbox"
id={`checkbox-${item.id}`}
aria-label={`Mark ${item.name} as purchased.`}
value={item.id}
checked={isChecked}
onChange={handleCheckChange}
aria-checked={isChecked}
disabled={isChecked}
/>
<ItemQuantityForm saveItemQuantity={editItemQuantity} item={item} /> x{" "}
{item.name}{" "}
<span>
{getUrgencyStatus(item)}
<Button className="custom-button" onClick={() => deleteItemHandler()}>
Delete Item
</Button>
<div className="d-flex flex-column justify-content-center mt-5">
<span
className={`UrgencyStatus text-center text-nowrap ms-5 w-auto p-1 ${urgencyStatus.replace(/\s/g, "-")}`}
>
{urgencyStatus}
</span>
<section className="ListItemBox custom-borders d-flex p-2 m-1 align-items-center">
<section className="PurchaseItem d-flex flex-grow-1">
<Form.Check
className="me-3"
type="checkbox"
id={`checkbox-${item.id}`}
aria-label={`Mark ${item.name} as purchased.`}
value={item.id}
checked={isChecked}
onChange={handleCheckChange}
aria-checked={isChecked}
disabled={isChecked}
/>
<Form.Label>{item.name}</Form.Label>
</section>

<section className="EditItem d-flex gap-2 align-items-end">
<ItemQuantityForm saveItemQuantity={editItemQuantity} item={item} />

<Button
className="DeleteButton w-auto"
variant="danger"
onClick={() => deleteItemHandler()}
>
<span className="d-none d-md-inline">Delete</span>
<MdOutlineDeleteForever className=" d-block d-md-none" />
</Button>
</section>
</section>
</div>
);
}
6 changes: 3 additions & 3 deletions src/components/NavBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
color: $secondary-blue;
}
}
}

.navbar .navbar-toggler {
background-color: $primary-beige;
}
.navbar .navbar-toggler {
background-color: $primary-beige;
}

.navbar button {
Expand Down
9 changes: 1 addition & 8 deletions src/components/authenticated/AuthenticatedNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ export function AuthenticatedNavBar() {
<Nav.Link as={NavLink} to="/" aria-label="Home" eventKey={"1"}>
Home
</Nav.Link>
<Nav.Link
as={NavLink}
to="/manage-list"
aria-label="Manage List"
eventKey={"2"}
>
Manage List
</Nav.Link>

<Nav.Link
as={NavLink}
to="/about"
Expand Down
20 changes: 20 additions & 0 deletions src/components/forms/AddItemForm.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@import "../../styles/variables";

.custom-borders {
border: 2px solid $secondary-blue !important;
border-radius: 4px !important;
padding: 20px;
margin-top: 20px;
position: relative;
}

.legend-text {
font-weight: bold;
padding: 0 10px; /* Creates space between the border and text */
color: #001f3f; /* Optional: text color */
position: relative;
top: -40px;
left: 60px;
background-color: rgb(241, 230, 204);
width: 60%;
}
Loading