This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forms): 🎨 Make student selector 2 column
Creates a 2 column layout for the student selector. When a student is chosen they will be moved to the right column Signed-off-by: Matthew Gray <[email protected]>
- Loading branch information
Showing
5 changed files
with
169 additions
and
54 deletions.
There are no files selected for viewing
134 changes: 96 additions & 38 deletions
134
commendations/static/commendations/giveCommendation.css
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 |
---|---|---|
@@ -1,75 +1,133 @@ | ||
form { | ||
margin: 0 auto; | ||
max-width: 500px; | ||
padding: 1rem; | ||
background-color: var(--color-grey-light); | ||
border-radius: 0.5rem; | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2); | ||
margin: 0 auto; | ||
max-width: 500px; | ||
padding: 1rem; | ||
background-color: var(--color-grey-light); | ||
border-radius: 0.5rem; | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
.formField { | ||
margin-bottom: 2rem; | ||
width: 100%; | ||
margin-bottom: 2rem; | ||
width: 100%; | ||
} | ||
|
||
.formField:last-of-type { | ||
margin-bottom: 0; | ||
margin-bottom: 0; | ||
} | ||
|
||
form * { | ||
box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
|
||
form input, | ||
form select, | ||
form textarea { | ||
display: block; | ||
margin: 0.5em 0; | ||
padding: 0.5em; | ||
border: 1px solid var(--color-grey-dark); | ||
border-radius: 0.25rem; | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2); | ||
width: 100%; | ||
display: block; | ||
margin: 0.5em 0; | ||
padding: 0.5em; | ||
border: 1px solid var(--color-grey-dark); | ||
border-radius: 0.25rem; | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2); | ||
width: 100%; | ||
} | ||
|
||
form textarea { | ||
height: 5rem; | ||
resize: vertical; | ||
height: 5rem; | ||
resize: vertical; | ||
} | ||
|
||
form select:not(#teacher, #quickReason) { | ||
height: 10rem; | ||
height: 10rem; | ||
} | ||
|
||
form input[type="radio"] { | ||
margin-left: 1em; | ||
margin-right: 0.3em; | ||
display: inline-block; | ||
width: auto; | ||
box-shadow: 0 0rem 0rem rgba(0, 0, 0, 0.2); | ||
border: none; | ||
transform: translateY(0.15rem); | ||
margin-left: 1em; | ||
margin-right: 0.3em; | ||
display: inline-block; | ||
width: auto; | ||
box-shadow: 0 0rem 0rem rgba(0, 0, 0, 0.2); | ||
border: none; | ||
transform: translateY(0.15rem); | ||
} | ||
|
||
form input[type="radio"]:checked+label { | ||
background-color: var(--color-gold); | ||
background-color: var(--color-gold); | ||
} | ||
|
||
form #submit { | ||
background-color: var(--color-gold); | ||
color: var(--color-grey-dark); | ||
font-weight: bold; | ||
cursor: pointer; | ||
background-color: var(--color-gold); | ||
color: var(--color-grey-dark); | ||
font-weight: bold; | ||
cursor: pointer; | ||
} | ||
|
||
.errorMessage { | ||
color: red; | ||
font-weight: bold; | ||
margin-bottom: 1rem; | ||
color: red; | ||
font-weight: bold; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.hint { | ||
color: var(--color-grey-dark); | ||
font-size: 0.8rem; | ||
margin-bottom: 1rem; | ||
color: var(--color-grey-dark); | ||
font-size: 0.8rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
#searchStudents { | ||
grid-column: span 2; | ||
} | ||
|
||
/* 2 Col layout for student selection */ | ||
/* Parent div with ID 2ColSelector */ | ||
.selector { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
grid-gap: 0.3rem; | ||
margin-bottom: 2rem; | ||
} | ||
|
||
.selectorCol { | ||
border: 1px solid var(--color-grey-dark); | ||
border-radius: 0.25rem; | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2); | ||
height: 15rem; | ||
overflow-y: scroll; | ||
padding: 2px; | ||
/* Adjust padding as needed */ | ||
} | ||
|
||
.selector>div>ul { | ||
list-style-type: none; | ||
padding: 2px; | ||
margin: 0; | ||
} | ||
|
||
.selector>div>ul>li:hover, | ||
.selected { | ||
background-color: var(--color-gold); | ||
} | ||
|
||
|
||
|
||
.selector>div>ul>li { | ||
cursor: pointer; | ||
} | ||
|
||
.selector>div>ul>li>input { | ||
margin-right: 0.2rem; | ||
display: none; | ||
} | ||
|
||
|
||
/* Mobile friendly version */ | ||
|
||
@media only screen and (max-width: 600px) { | ||
.selector { | ||
grid-template-columns: 1fr; | ||
} | ||
|
||
form { | ||
max-width: 100%; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,37 @@ | ||
function filterStudents(searchTerm) { | ||
var students = document.getElementsByClassName("studentChoice"); | ||
for (var i = 0; i < students.length; i++) { | ||
if (students[i].text.toLowerCase().indexOf(searchTerm.toLowerCase()) > -1) { | ||
students[i].style.display = ""; | ||
var selectableStudents = document.getElementById('selectable-students').getElementsByTagName("li"); | ||
var selectedStudents = document.getElementById('selected-students').getElementsByTagName("li"); | ||
|
||
if (searchTerm == "") { | ||
for (var i = 0; i < selectableStudents.length; i++) { | ||
selectableStudents[i].style.display = ""; | ||
} | ||
|
||
for (var i = 0; i < selectedStudents.length; i++) { | ||
selectedStudents[i].style.display = ""; | ||
} | ||
|
||
return; | ||
} | ||
|
||
|
||
searchTerm = searchTerm.toLowerCase(); | ||
|
||
for (var i = 0; i < selectableStudents.length; i++) { | ||
var studentName = selectableStudents[i].innerHTML.toLowerCase(); | ||
if (studentName.indexOf(searchTerm) > -1) { | ||
selectableStudents[i].style.display = ""; | ||
} else { | ||
selectableStudents[i].style.display = "none"; | ||
} | ||
} | ||
|
||
for (var i = 0; i < selectedStudents.length; i++) { | ||
var studentName = selectedStudents[i].innerHTML.toLowerCase(); | ||
if (studentName.indexOf(searchTerm) > -1) { | ||
selectedStudents[i].style.display = ""; | ||
} else { | ||
students[i].style.display = "none"; | ||
selectedStudents[i].style.display = "none"; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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