diff --git a/cs/chatButton.css b/cs/chatButton.css new file mode 100644 index 0000000..6e5414c --- /dev/null +++ b/cs/chatButton.css @@ -0,0 +1,168 @@ +*{ + margin: 0; + padding: 0; + box-sizing: border-box; +} + +button{ + border:none; + outline: none; + cursor: pointer; +} + +body{ + font-family: Arial, Helvetica, sans-serif; + /* background-color: #9a3131; + display: flex; + justify-content: center; + height: 100vh; + width: 100%; */ +} + +/* section{ + max-width: 1100px; + margin: auto; + text-align: center; + padding: 0 1rem; +} */ +.chat-btn{ + position: fixed; + right:50px; + bottom: 50px; + background: dodgerblue; + color: white; + width:60px; + height: 60px; + border-radius: 50%; + opacity: 0.8; + transition: opacity 0.3s; + box-shadow: 0 5px 5px rgba(0,0,0,0.4); +} + +.chat-btn:hover, .submit:hover, #emoji-btn:hover{ + opacity: 1; +} + +.chat-popup{ + display: none; + position: fixed; + bottom:80px; + right:120px; + height: 400px; + width: 300px; + background-color: white; + /* display: flex; */ + flex-direction: column; + justify-content: space-between; + padding: 0.75rem; + box-shadow: 5px 5px 5px rgba(0,0,0,0.4); + border-radius: 10px; +} + +.show{ + display: flex; +} + +.chat-area{ + height: 80%; + overflow-y: auto; + overflow-x: hidden; +} + +.income-msg{ + display: flex; + align-items: center; +} + +.avatar{ + width:45px; + height: 45px; + border-radius: 50%; + object-fit: cover; +} + +.income-msg .msg{ + background-color: dodgerblue; + color: white; + padding:0.5rem; + border-radius: 25px; + margin-left: 1rem; + box-shadow: 0 2px 5px rgba(0,0,0,0.4); +} + +/* .badge{ + position: absolute; + width: 30px; + height: 30px; + background-color: red; + color:white; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + top:-10px; + right: -10px; +} */ + + +.input-area{ + position: relative; + display: flex; + justify-content: center; +} + +input[type="text"]{ + width:100%; + border: 1px solid #ccc; + font-size: 1rem; + border-radius: 5px; + height: 2.2rem; +} + +#emoji-btn{ + position: absolute; + font-size: 1.2rem; + background: transparent; + right: 50px; + top:2px; + opacity:0.5; +} + +.submit{ + padding: 0.25rem 0.5rem; + margin-left: 0.5rem; + background-color: green; + color:white; + display: flex; + justify-content: center; + align-items: center; + border-radius: 5px; + opacity: 0.7; +} + + +.out-msg{ + display: flex; + justify-content: flex-end; + align-items: center; +} +.my-msg{ + display: flex; + justify-content: flex-end; + margin: 0.75rem; + padding: 0.5rem; + background-color: #ddd; + border-radius: 25px; + box-shadow: 0 2px 5px rgba(0,0,0,0.4); + word-break: break-all; +} + + +@media (max-width:500px){ + + .chat-popup{ + bottom: 120px; + right:10%; + width: 80vw; + } +} \ No newline at end of file diff --git a/cs/chatButton.js b/cs/chatButton.js new file mode 100644 index 0000000..a90bbaf --- /dev/null +++ b/cs/chatButton.js @@ -0,0 +1,39 @@ +const popup = document.querySelector('.chat-popup'); +const chatBtn = document.querySelector('.chat-btn'); +const submitBtn = document.querySelector('.submit'); +const chatArea = document.querySelector('.chat-area'); +const inputElm = document.querySelector('input'); +const emojiBtn = document.querySelector('#emoji-btn'); +const picker = new EmojiButton(); + + +// Emoji selection +window.addEventListener('DOMContentLoaded', () => { + + picker.on('emoji', emoji => { + document.querySelector('input').value += emoji; + }); + + emojiBtn.addEventListener('click', () => { + picker.togglePicker(emojiBtn); + }); + }); + +// chat button toggler + +chatBtn.addEventListener('click', ()=>{ + popup.classList.toggle('show'); +}) + +// send msg +submitBtn.addEventListener('click', ()=>{ + let userInput = inputElm.value; + let lenghtInput = inputElm.value.length; + if(lenghtInput!=0){ + let temp = `
+ ${userInput} +
`; + chatArea.insertAdjacentHTML("beforeend", temp); + inputElm.value = ''; + } +}) \ No newline at end of file diff --git a/cs/img/person.jpg b/cs/img/person.jpg new file mode 100644 index 0000000..4ddb1e8 Binary files /dev/null and b/cs/img/person.jpg differ diff --git a/cs/index.html b/cs/index.html new file mode 100644 index 0000000..894297d --- /dev/null +++ b/cs/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + +
+ +
+
+
+ + Hi, How can I help you? +
+
+ +
+ + + +
+
+
+ + + + + + \ No newline at end of file diff --git a/cs/index.php b/cs/index.php index f1e9715..577809e 100644 --- a/cs/index.php +++ b/cs/index.php @@ -1,6 +1,7 @@ + Student Wellbeing Committee - IIT Jodhpur @@ -396,4 +397,7 @@ class="fb-xfbml-parse-ignore"> \ No newline at end of file +?> +