Skip to content

Commit

Permalink
FAIR SHARE 1.1.0
Browse files Browse the repository at this point in the history
Add Responsive
Add Form Alerts
Add SweetAlert2
Update App.js
Update README.md
  • Loading branch information
DavidGomezToca committed Sep 2, 2024
1 parent 0e2e8ff commit a65c3b3
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

- **STACK :**

- **Fair Share** : `1.0.0`
- **Fair Share** : `1.1.0`
- **React** : `18.3.1`
- **React Dom** : `18.3.1`
- **SweetAlert2** : `11.12.4`

---

Expand All @@ -25,4 +26,4 @@
- **CREDITS :**

- **Author : [David Gómez](https://github.com/DavidGomezToca)**
- **Resources : [Flaticon](https://www.flaticon.com/)**
- **Resources : [Flaticon](https://www.flaticon.com/)**
14 changes: 12 additions & 2 deletions 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
@@ -1,6 +1,6 @@
{
"name": "fair-share",
"version": "1.0.0",
"version": "1.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
Expand All @@ -9,6 +9,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-scripts": "5.0.1",
"sweetalert2": "^11.12.4",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
27 changes: 26 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Swal from "sweetalert2";
import { useState } from "react";
import FriendsData from "../data/friendsData.json";

Expand Down Expand Up @@ -120,7 +121,31 @@ function FormSplitBill({ selectedFriend, onSplitBill }) {

function handleSubmit(e) {
e.preventDefault();
if (!bill || !paidByUser) return;

if (!bill || !paidByUser) {
Swal.fire({
title: "All fields required", icon: "info",
customClass: {
htmlContainer: "swal2-text",
confirmButton: "swal2-text",
popup: "swal2-popup"
}
});
return;
};

if (bill < 0 || paidByUser < 0) {
Swal.fire({
title: "Values must be above 0", icon: "info",
customClass: {
htmlContainer: "swal2-text",
confirmButton: "swal2-text",
popup: "swal2-popup"
}
});
return;
};

onSplitBill(whoIsPaying === "user" ? paidByFriend : -paidByUser);
}

Expand Down
17 changes: 16 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,19 @@ form h2 {
text-transform: uppercase;
letter-spacing: -0.5px;
margin-bottom: 1.6rem;
}
}

.swal2-text {
font-size: 18px !important;
}

.swal2-popup {
font-size: 12px !important;
}

@media (max-width: 1000px) {
.app {
grid-template-columns: 1fr;
row-gap: 4rem;
}
}

0 comments on commit a65c3b3

Please sign in to comment.