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

redesigned the Rate Music page #315

Merged
merged 6 commits into from
Aug 29, 2022
Merged
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
54 changes: 31 additions & 23 deletions rating/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,39 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css" />
<link href="star.ico" rel="icon" type="image/x-icon" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap" rel="stylesheet">
<title>Rate Song</title>
</head>
</head>z
<body>
<form name="rating" netlify>
<p>
<label class="song-name"
>Song Name:
<select name="song[]" multiple required>
<option value="christmas-song">Christmas Song</option>
<option value="baby-it's-cold-outside">Baby It's Cold Outside</option>
<option value="the-most-wonderful-time-of-the-year">The Most Wonderful Time of The Year</option>
<option value="last-christmas">Last Christmas</option>
<option value="little-saint-nick">Little Saint Nick</option>
<option value="all-i-want-for-christmas">All I Want For Christmas</option>
</select></label
>
</p>
<p>
<label class="rating"
>Rating - Out of 10 <input type="number" name="number" min="0" max="10" required/></label
></label>
</p>
<p>
<h3 Id="review_msg">
hello
</h3>
<main>
<h1>Ratings</h1>
<form name="rating" id="submit" netlify>

<label class="song-name">Song Name:</label><br/><br/>
<select class="select" name="song[]">
Copy link

Choose a reason for hiding this comment

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

Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.

Copy link

Choose a reason for hiding this comment

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

Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.

<option value="--choose song">Choose Song</option>
<option value="christmas-song">Christmas Song</option>
<option value="baby-it's-cold-outside">Baby It's Cold Outside</option>
<option value="the-most-wonderful-time-of-the-year">The Most Wonderful Time of The Year</option>
<option value="last-christmas">Last Christmas</option>
<option value="little-saint-nick">Little Saint Nick</option><option value="all-i-want-for-christmas">All I Want For Christmas</option>
</select><br/><br/><br/>


<label class="">Rating - Out of 10 : <span id="demo"></span></label><br/><br/>
<input name='rating' type="range" id="rating" class="rating" max="10" step="1" value=0 onchange="handleChange()" required/><br/><br/>

<button class="btn" type="submit">Submit Rating</button>
</p>
</form>
</p>
</form>
<p id="demo"></p>
</main>
<script src="index.js"></script>

</body>
</html>
24 changes: 24 additions & 0 deletions rating/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// get the input
const rating = document.getElementById("rating");

// handles changes in the input and renders values to the screen
function handleChange() {
const res = document.getElementById("demo");
res.innerHTML = rating.value;
}
// Actions that takes oplace once the form is submitted
const submit = document.querySelector("#submit");
submit.addEventListener("submit", handleSubmit);

function handleSubmit(e) {
e.preventDefault(); // stops browser default behhaviour of automatically submitting

if (rating.value === '0') {
const review_msg = document.querySelector("#review_msg");
review_msg.style.visibility = "visible";
review_msg.innerText = "You must choose a rating"
}else{
review_msg.style.visibility = 'visible'
review_msg.innerText = 'Success'
}
}
Binary file added rating/photo1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rating/pink-wavy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 117 additions & 30 deletions rating/styles.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,129 @@
.song-name,
.rating {
color: limegreen;
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

.song-name {
width: 200px;
body{
background: url('photo1.jpeg');
background-size: cover;
width: 100%;
display: column;
align-items: center;
justify-content: center;
color: white;
max-width: 100%;
}

input {
color: red;
main{
margin-top:3em;
width: 100%;
display: column;
justify-content: center;
align-items: center;
height: 70vh;
background: rgba(0,0,0, 0.9);
}

.btn {
background-image: linear-gradient(
to right,
#d31027 0%,
#ea384d 51%,
#d31027 100%
);
margin: 10px;
padding: 15px 45px;
h1{
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
margin: 1em;
color: white;
box-shadow: 0 0 20px #eee;
padding: 10px;
font-weight: 800;
font-size: xx-large;
font-family: 'Poppins',sans-serif;
}
h3{
border: ipx solid white;
box-shadow: 6px 2px 2px rgba(0,0,0,0.15);
width: 80%;
height: 100px;
padding: 30px;
text-align: center;
background-color: rgba(255,255,255,0.2);
margin: auto;
visibility: hidden;
border-radius: 10px;
display: block;
}
form{
margin: auto;
width: 70%;
text-align: center;
}
label{
font-family: 'Poppins', sans-serif

}
.select{
height:50px;
text-align: center;
border-radius: 5px;
padding: 5px;
color: white;
margin: 5px;
border: 1px solid white;
background-color: black;
}
.rating{
width: 300px;
color: purple;

.btn:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
.btn{
margin-top: 1rem;
height: 50px;
width: 140px;
border: 1px solid white;
border-radius: 5px;
padding: 7px;
color: white;
font-weight: bolder;
background-color: rgb(0,0,0);
transform: scale(1);
transition: 0.5s;

body {
max-width: 100%;
overflow-x: hidden;
}
.btn:hover{
background: #f5f5f5;
color: rgb(0, 0, 0);
transform: scale(1.1);
}
/* for large screens */
@media screen and (min-width : 750px){
body{
background: url('./pink-wavy.jpg') no-repeat;
background-size: cover;
display: flex;
width: 100%;
height: 100%;
color: black;
flex-direction: column;
justify-content: center;
align-items: center;
}
main{
width: 70%;
height: 80vh;
margin-top: 3em;
background-color: white;
border-radius: 10px;
}
h1{
text-align: center;
margin: 1em;
color: black;
padding: 10px;
font-weight: 800;
font-size: xx-large;
font-family: 'Poppins',sans-serif;
}
.select{
height:50px;
text-align: center;
border-radius: 5px;
padding: 5px;
color: black;
margin: 5px;
border: 1px solid black;
background-color: transparent;
}
}
3 changes: 3 additions & 0 deletions rating/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const title = document.querySelector('#demo')

console.log(title)