|
@@ -0,0 +1,163 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="chat-app">
|
|
|
|
+ <aside class="sidebar">
|
|
|
|
+ <header>
|
|
|
|
+ <h1>Application Title</h1>
|
|
|
|
+ </header>
|
|
|
|
+ <ul class="contacts-list">
|
|
|
|
+ <li v-for="contact in contacts" :key="contact.id" @click="selectContact(contact)">
|
|
|
|
+ {{ contact.name }}
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
|
|
+ </aside>
|
|
|
|
+ <main class="chat-area">
|
|
|
|
+ <div class="message-bubble" v-for="message in messages" :key="message.id" :class="{ 'sent': message.sender === 'me', 'received': message.sender !== 'me' }">
|
|
|
|
+ <p>{{ message.text }}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </main>
|
|
|
|
+ <section class="card-area">
|
|
|
|
+ <div class="card" v-for="card in cards" :key="card.id">
|
|
|
|
+ <p>{{ card.title }}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </section>
|
|
|
|
+ <footer class="input-area">
|
|
|
|
+ <form @submit.prevent="sendMessage">
|
|
|
|
+ <input type="text" v-model="newMessageText" placeholder="Type a message...">
|
|
|
|
+ <button type="submit">Send</button>
|
|
|
|
+ <label>
|
|
|
|
+ <input type="file" @change="onFileSelected">
|
|
|
|
+ <span>Upload File</span>
|
|
|
|
+ </label>
|
|
|
|
+ </form>
|
|
|
|
+ </footer>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ contacts: [
|
|
|
|
+ { id: 1, name: 'Alice' },
|
|
|
|
+ { id: 2, name: 'Bob' },
|
|
|
|
+ { id: 3, name: 'Charlie' },
|
|
|
|
+ ],
|
|
|
|
+ selectedContact: null,
|
|
|
|
+ messages: [],
|
|
|
|
+ newMessageText: '',
|
|
|
|
+ cards: [
|
|
|
|
+ { id: 1, title: 'Card 1' },
|
|
|
|
+ { id: 2, title: 'Card 2' },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ selectContact(contact) {
|
|
|
|
+ this.selectedContact = contact;
|
|
|
|
+ // Fetch messages for the selected contact
|
|
|
|
+ this.messages = [
|
|
|
|
+ { id: 1, sender: 'me', text: 'Hello, Alice!' },
|
|
|
|
+ { id: 2, sender: 'other', text: 'Hi there!' },
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
+ sendMessage() {
|
|
|
|
+ if (this.newMessageText.trim()) {
|
|
|
|
+ this.messages.push({ id: this.messages.length + 1, sender: 'me', text: this.newMessageText });
|
|
|
|
+ this.newMessageText = '';
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onFileSelected(event) {
|
|
|
|
+ // Handle file upload
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.chat-app {
|
|
|
|
+ display: flex;
|
|
|
|
+ height: 100vh;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.sidebar {
|
|
|
|
+ width: 250px;
|
|
|
|
+ background-color: #08002e;
|
|
|
|
+ color: white;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.contacts-list li {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.chat-area {
|
|
|
|
+ flex-grow: 1;
|
|
|
|
+ background-color: white;
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.message-bubble {
|
|
|
|
+ margin: 10px 0;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ max-width: 70%;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.message-bubble.sent {
|
|
|
|
+ background-color: #795548;
|
|
|
|
+ align-self: flex-end;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.message-bubble.received {
|
|
|
|
+ background-color: #e0e0e0;
|
|
|
|
+ align-self: flex-start;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.card-area {
|
|
|
|
+ width: 200px;
|
|
|
|
+ background-color: grey;
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.card {
|
|
|
|
+ background-color: #fbefff;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ margin-bottom: 10px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area {
|
|
|
|
+ background-color: white;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ border-top: 1px solid #e0e0e0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area form {
|
|
|
|
+ display: flex;
|
|
|
|
+ gap: 10px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area input {
|
|
|
|
+ flex-grow: 1;
|
|
|
|
+ border: 1px solid #e0e0e0;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area button {
|
|
|
|
+ background-color: #795548;
|
|
|
|
+ color: white;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ border: none;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ padding: 10px 20px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area label {
|
|
|
|
+ background-color: #795548;
|
|
|
|
+ color: white;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+}
|
|
|
|
+</style>
|