-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Freelance Rate Calculator (#1303)
- Loading branch information
Showing
5 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,15 @@ | ||
# <p align="center">Freelance Rate Calculator</p> | ||
|
||
## Description :- | ||
|
||
The Freelance Rate Calculator is a tool that helps freelancers determine their optimal hourly or project-based rates based on various factors like desired annual income, billable hours per week, and vacation weeks per year. | ||
|
||
## Tech Stacks :- | ||
|
||
- HTML | ||
- CSS | ||
- JavaScript | ||
|
||
## Screenshots :- | ||
|
||
![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/3064e1c5-5c81-4b82-ba1e-cdc880fe609a) |
This file contains 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,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="style.css"> | ||
<title>Freelance Rate Calculator</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Freelance Rate Calculator</h1> | ||
<form id="rateCalculator"> | ||
<label for="annual-salary">Desired Annual Salary ($):</label> | ||
<input type="number" id="annual-salary" required> | ||
|
||
<label for="billable-hours">Billable Hours per Week:</label> | ||
<input type="number" id="billable-hours" required> | ||
|
||
<label for="vacation-weeks">Vacation Weeks per Year:</label> | ||
<input type="number" id="vacation-weeks" required> | ||
|
||
<button type="submit">Calculate</button> | ||
</form> | ||
<div id="result"> | ||
<h2>Your Hourly Rate: $<span id="hourly-rate">0</span></h2> | ||
</div> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains 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,24 @@ | ||
document.getElementById('rateCalculator').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
|
||
const annualSalary = parseFloat(document.getElementById('annual-salary').value); | ||
const billableHours = parseFloat(document.getElementById('billable-hours').value); | ||
const vacationWeeks = parseFloat(document.getElementById('vacation-weeks').value); | ||
|
||
if (isNaN(annualSalary) || isNaN(billableHours) || isNaN(vacationWeeks)) { | ||
alert('Please fill in all fields with valid numbers.'); | ||
return; | ||
} | ||
|
||
const weeksPerYear = 52; | ||
const workingWeeks = weeksPerYear - vacationWeeks; | ||
const totalBillableHours = workingWeeks * billableHours; | ||
|
||
if (totalBillableHours <= 0) { | ||
alert('Total billable hours must be greater than zero.'); | ||
return; | ||
} | ||
|
||
const hourlyRate = annualSalary / totalBillableHours; | ||
document.getElementById('hourly-rate').textContent = hourlyRate.toFixed(2); | ||
}); |
This file contains 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,96 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
overflow: hidden; | ||
margin: 0; | ||
} | ||
|
||
.container { | ||
background: white; | ||
padding: 30px 20px; | ||
border-radius: 10px; | ||
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); | ||
width: 350px; | ||
position: relative; | ||
z-index: 1; | ||
text-align: center; | ||
} | ||
|
||
h1 { | ||
font-size: 26px; | ||
margin-bottom: 20px; | ||
color: #333; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
label { | ||
margin-bottom: 5px; | ||
font-weight: bold; | ||
color: #555; | ||
} | ||
|
||
input { | ||
margin-bottom: 15px; | ||
padding: 10px; | ||
width: 100%; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
} | ||
|
||
button { | ||
padding: 10px 15px; | ||
background-color: #007bff; | ||
color: white; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
width: 100%; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
} | ||
|
||
#hourly-rate { | ||
font-size: 24px; | ||
color: #007bff; | ||
} | ||
|
||
/* Background Animation */ | ||
body::before { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background: linear-gradient(45deg, #ff6b6b, #f8e71c, #7ed321, #50e3c2, #4a90e2, #b8e986, #d0021b); | ||
background-size: 400% 400%; | ||
z-index: 0; | ||
animation: gradientBackground 15s ease infinite; | ||
} | ||
|
||
@keyframes gradientBackground { | ||
0% { | ||
background-position: 0% 50%; | ||
} | ||
50% { | ||
background-position: 100% 50%; | ||
} | ||
100% { | ||
background-position: 0% 50%; | ||
} | ||
} |
This file contains 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