-
Notifications
You must be signed in to change notification settings - Fork 1
Chen #26
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
Open
Chen-kaduri
wants to merge
3
commits into
main
Choose a base branch
from
chen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Chen #26
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| body { | ||
| color: hsl(186, 14%, 43%); | ||
| background-color: hsl(185, 41%, 84%); | ||
| font-family: "Space Mono", monospace; | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| .firstContainer { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| margin: auto; /*center the elements in the container*/ | ||
| text-align: center; | ||
| padding: 2rem; | ||
| width: 90%; | ||
| max-width: 50rem; | ||
| } | ||
|
|
||
| .calculator { | ||
| margin-top: 2rem; | ||
| background-color: white; | ||
| display: flex; | ||
| flex-wrap: wrap; /*responsive*/ | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| padding: 1rem; | ||
| border-radius: 0.625rem; | ||
| } | ||
|
|
||
| .input-bill { | ||
| flex: 1; | ||
| min-width: 15rem; /* adjust to smaller screens */ | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| text-align: left; | ||
| padding: 1rem; | ||
| } | ||
|
|
||
| .output-bill{ | ||
| flex: 1; | ||
| min-width: 15rem; /*adjust to smaller screens*/ | ||
| } | ||
|
|
||
|
|
||
| .input-icon { | ||
| position: relative; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .input-icon input { | ||
| background-color: hsl(189, 41%, 97%); | ||
| width: 70%; | ||
| padding-left: 2.5rem; | ||
| padding-right: 1rem; | ||
| height: 2rem; | ||
| font-size: 1rem; | ||
| border: 0.063rem solid #ccc; | ||
| border-radius: 0.5rem; | ||
| } | ||
|
|
||
| .input-icon img { | ||
| position: absolute; | ||
| top: 50%; | ||
| left: 0.625rem; | ||
| height: 1rem; | ||
| transform: translateY(-50%); | ||
| width: auto; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .tip-btn { | ||
| display: inline-flex; | ||
| gap: 0.5rem; | ||
| margin-top: 0.5rem; | ||
| width: 6rem; | ||
| height: 2.5rem; | ||
| cursor: pointer; | ||
| background-color: hsl(183, 100%, 15%); | ||
| color: white; | ||
| border: none; | ||
| font-family: "Space Mono", monospace; | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| border-radius: 0.5rem; | ||
| justify-content: center; | ||
| padding: 0.5rem; | ||
| } | ||
|
|
||
| .tip-btn:hover { | ||
| background-color: hsl(172, 67%, 45%); | ||
| } | ||
|
|
||
| #custom-btn:hover { | ||
| background-color: hsl(172, 67%, 45%); | ||
| } | ||
|
|
||
| #custom-btn { | ||
| background-color: hsl(189, 41%, 97%); | ||
| color: hsl(186, 14%, 43%); | ||
| font-family: "Space Mono", monospace; | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| } | ||
|
|
||
| .output-bill{ | ||
| text-align: left; | ||
| background-color: hsl(183, 100%, 15%); | ||
| border-radius: 0.5rem; | ||
| padding: 1rem; | ||
| } | ||
|
|
||
| #reset-btn { | ||
| text-align: center; | ||
| width: 90%; | ||
| height: 2.5rem; | ||
| border: none; | ||
| cursor: pointer; | ||
| background-color: hsl(172, 67%, 45%); | ||
| color: hsl(183, 100%, 15%); | ||
| font-family: "Space Mono", monospace; | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| display: block; | ||
| margin: 1rem auto; /* center the button*/ | ||
| border-radius: 0.5rem; | ||
| } | ||
|
|
||
| div h2 { | ||
| color: hsl(172, 67%, 45%); | ||
| } | ||
|
|
||
| div p span { | ||
| color: hsl(186, 14%, 43%); | ||
| } | ||
|
|
||
| .results { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .reset { | ||
| margin-top: 5rem; | ||
| } | ||
|
|
||
|
|
||
| @media (max-width: 375px) { | ||
| .container { | ||
| padding: 1rem; | ||
| width: 100%; /* full size in smaller screens */ | ||
| } | ||
|
|
||
| .calculator { | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| } | ||
|
|
||
| .output-bill, | ||
| .input-section { | ||
| min-width: 100%; /* maximize the space*/ | ||
| } | ||
|
|
||
| .tip-btn { | ||
| width: 100%; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| let bill = 0; | ||
| let numberPeople = 0; | ||
| let tip = 0; | ||
|
|
||
| // ההזנה ללחצן טיפ | ||
| const calcTip = (t) => { | ||
| tip = t; | ||
| } | ||
| // מה שהמשתמש הכניס ידנית (כמות ומספר חשבון) | ||
| const allUpdate = () => { | ||
| bill = document.getElementById("bill").value; | ||
| numberPeople = document.getElementById("people").value; | ||
| } | ||
|
|
||
|
|
||
| const test = () => { | ||
| if (isNaN(bill) || bill <= 0) { | ||
| alert("Please enter a valid bill amount"); | ||
| return; | ||
| } | ||
| //הכנסת מספר שלילי של אנשים | ||
| if (isNaN(numberPeople) || numberPeople <= 0) { | ||
| alert("Please enter a valid number of people"); | ||
| return; | ||
| } | ||
| const tipAmount = ((bill * tip) / 100) / numberPeople; // לכל בנאדם- חישוב התשלום עם האחוז-TIP AMOUNT | ||
| const totalofperson = (bill / numberPeople) + tipAmount; | ||
|
|
||
| document.getElementById("tip-amount").innerHTML = `$${tipAmount.toFixed(2)}`;//התוצאה עם שתי ספרות אחרי הנקודה | ||
| document.getElementById("total").innerHTML = `$${totalofperson.toFixed(2)}`; | ||
| } | ||
|
|
||
| //הקשבה לבחירת המשתמש | ||
| document.getElementById("bill").addEventListener("input", allUpdate); | ||
| document.getElementById("people").addEventListener("input", allUpdate); | ||
| document.getElementById("submit-btn").addEventListener("click", test); | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use css variables
see https://www.w3schools.com/css/css3_variables.asp