Skip to content
Open

JS #35

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
103 changes: 68 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">

<title>Frontend Mentor | Tip calculator app</title>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="./images/favicon-32x32.png"
/>
<link rel="stylesheet" href="./styles.css" />

<!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
<style>
.attribution { font-size: 11px; text-align: center; }
.attribution a { color: hsl(228, 45%, 44%); }
</style>
</head>
<body>

Bill

Select Tip %
5%
10%
15%
25%
50%
Custom

Number of People

Tip Amount
/ person

Total
/ person

Reset
</body>
</html>
<title>Roey Kimhi | Tip calculator app</title>
</head>
<body>
<div class="container">
<section class="left">
<div class="input-container">
<label for="bill" style="color:hsl(184, 14%, 56%); font-weight: 700;">Bill</label>
<input
type="number"
id="bill"
placeholder="0"
min="0"
>
</div>
<div class="select-tip-container">
<label style="color:hsl(184, 14%, 56%); font-weight: 700;">Select Tip %</label>
<div class="button-container">
<button>5%</button>
<button>10%</button>
<button>15%</button>
<button>25%</button>
<button>50%</button>
<button>Custom</button>
</div>
</div>
<div class="input-container">
<label for="bill" style="color:hsl(184, 14%, 56%); font-weight: 700;">Number of People</label>
<input
type="number"
id="numOfPeople"
placeholder="0"
min="0"
>
</div>

</section>
<section class="right">
<div class="amount-container">
<div class="text-container">
<h4>Tip Amount</h6>
<p style="color: hsl(186, 14%, 43%); ">/ person</p>
</div>

<h1 style="font-size: 2.5rem; color: hsl(172, 67%, 45%);">$0.00</h1>
</div>
<div class="amount-container">
<div class="text-container">
<h4>Total</h6>
<p style="color: hsl(186, 14%, 43%); ">/ person</p>
</div>

<h1 style="font-size: 2.5rem; color: hsl(172, 67%, 45%);">$0.00</h1>
</div>
<button class="reset">RESET</button>
</section>
</div>
</body>
</html>
150 changes: 150 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900;1,100..900&family=Outfit:wght@100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Space Mono", monospace;
}

body {
background-color: hsl(185, 41%, 84%);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;

color: white;
}

.left {
width: 50%;
display: flex;
flex-direction: column;
gap: 2rem;
}

.right {
width: 50%;
background-color: hsl(183, 100%, 15%);
border-radius: 10px;
padding: 2rem;
display: flex;
flex-direction: column;
gap: 2rem;
}

.container {
display: flex;
background-color: hsl(0, 0%, 100%);
width: 50%;
padding: 2rem;
border-radius: 10px;
gap: 2rem;
}

h4 {
font-weight: 700;
color: hsl(189, 41%, 97%);
}

.text-container {
display: flex;
flex-direction: column;
gap: 0.25rem;
}

.amount-container {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1.5rem;
}

.reset {
background-color: hsl(172, 67%, 45%);
color: hsl(186, 14%, 43%);
font-size: 1rem;
font-weight: 700;
border: none;
padding: 0.5rem 1rem;
border-radius: 5px;
cursor: pointer;
background-color: hsl(184, 14%, 56%);
box-shadow: 0 5px hsl(185, 91%, 17%);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

.input-container {
display: flex;
flex-direction: column;
position: relative;
gap: 0.5rem;
}

input {
height: 2.25rem;
border: none;
border-radius: 5px;
text-align: right;
color: hsl(184, 14%, 56%);
font-size: larger;
position: relative;
padding-right: 1rem;
background: url("images/icon-dollar.svg") no-repeat 1rem;
background-size: 12px;
background-color: hsl(189, 41%, 97%);
}
#numOfPeople {
background: url("images/icon-person.svg") no-repeat 1rem;
background-color: hsl(189, 41%, 97%);
}

::placeholder {
color: hsl(184, 14%, 56%);
}

.button-container {
display: flex;
flex-wrap: wrap; /* allows items to wrap to the next line */
gap: 10px;
justify-content: flex-start;
}

.button-container button {
flex: 1 1 calc(33.333% - 20px); /* 33% width minus gap adjustment */
max-width: 150px; /* Limit button width */
height: 50px;
font-size: 16px;
background-color: hsl(183, 100%, 15%); /* Main color */
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}

@media (max-width: 1120px) {
.container {
width: 100%;
}

.left,
.right {
width: 100%;
}

.right {
padding: 1rem;
}

.button-container button {
flex: 1 1 calc(50% - 20px); /* 50% width minus gap adjustment */
}
h1 {
font-size: small;
}
}