Skip to content

Commit 74e0511

Browse files
committed
make delete tag work
1 parent 00c4445 commit 74e0511

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

frontend/javascript/modules/majorProjectForm.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ export default class MajorProjectForm {
3535
document.getElementsByClassName("placeholder").item(0).remove()
3636
}
3737
let txt = input.value.replace(/[^a-zA-Z0-9\+\-\.\# ]/g, ''); // allowed characters list
38-
if (txt) input.insertAdjacentHTML("beforebegin", '<span class="skill-tag">' + txt + '</span>');
38+
if (txt) input.insertAdjacentHTML("beforebegin", '<span class="skill-tag" id=f"ski">' + txt + '</span>');
39+
let skills = document.getElementsByClassName("skill-tag")
40+
skills[skills.length - 1].addEventListener('click', e => this.onRemoveTag(e));
3941
input.value = "";
4042
input.focus();
4143

4244
}
4345

46+
onRemoveTag(e) {
47+
e.target.remove();
48+
}
49+
4450
_submitForm(e) {
4551
e.preventDefault();
4652

frontend/stylesheets/pages/_major-project.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
margin: 2px 3px;
3838
color: #444;
3939
border-radius: 5px;
40+
transition: .5s all;
4041
}
4142

4243
.skill-tag:after {
@@ -47,4 +48,8 @@
4748
padding: 0 4px;
4849
margin: 3px 0 10px 7px;
4950
font-size: 10px;
51+
}
52+
53+
.skill-tag:hover {
54+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
5055
}

0 commit comments

Comments
 (0)