8 changed files with 138 additions and 11 deletions
			
			
		| Before Width: | Height: | Size: 4.5 MiB After Width: | Height: | Size: 4.5 MiB | 
| After Width: | Height: | Size: 705 KiB | 
| @ -0,0 +1,72 @@ | |||||
|  | <template> | ||||
|  |   <div v-if="visible" class="dialog-overlay"> | ||||
|  |     <div class="dialog"> | ||||
|  |       <h1>Received from {{ contact?.name || "nobody in particular" }}</h1> | ||||
|  |       <p>{{ message }}</p> | ||||
|  |       <input | ||||
|  |         type="text" | ||||
|  |         class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" | ||||
|  |         placeholder="What you received" | ||||
|  |         v-model="description" | ||||
|  |       /> | ||||
|  |       <button @click="confirm">Confirm</button> | ||||
|  |         | ||||
|  |       <button @click="cancel">Cancel</button> | ||||
|  |     </div> | ||||
|  |   </div> | ||||
|  | </template> | ||||
|  | 
 | ||||
|  | <script> | ||||
|  | export default { | ||||
|  |   props: ["message"], | ||||
|  |   data() { | ||||
|  |     return { | ||||
|  |       contact: null, | ||||
|  |       description: "", | ||||
|  |       visible: false, | ||||
|  |     }; | ||||
|  |   }, | ||||
|  |   methods: { | ||||
|  |     open(contact) { | ||||
|  |       this.contact = contact; | ||||
|  |       this.visible = true; | ||||
|  |     }, | ||||
|  |     close() { | ||||
|  |       this.visible = false; | ||||
|  |     }, | ||||
|  |     confirm() { | ||||
|  |       this.close(); | ||||
|  |       this.$emit("dialog-result", { | ||||
|  |         action: "confirm", | ||||
|  |         contact: this.contact, | ||||
|  |         description: this.description, | ||||
|  |       }); | ||||
|  |     }, | ||||
|  |     cancel() { | ||||
|  |       this.close(); | ||||
|  |       this.$emit("dialog-result", { action: "cancel" }); | ||||
|  |     }, | ||||
|  |   }, | ||||
|  | }; | ||||
|  | </script> | ||||
|  | 
 | ||||
|  | <style> | ||||
|  | .dialog-overlay { | ||||
|  |   position: fixed; | ||||
|  |   top: 0; | ||||
|  |   left: 0; | ||||
|  |   right: 0; | ||||
|  |   bottom: 0; | ||||
|  |   background-color: rgba(0, 0, 0, 0.5); | ||||
|  |   display: flex; | ||||
|  |   justify-content: center; | ||||
|  |   align-items: center; | ||||
|  | } | ||||
|  | 
 | ||||
|  | .dialog { | ||||
|  |   background-color: white; | ||||
|  |   padding: 1rem; | ||||
|  |   border-radius: 0.5rem; | ||||
|  |   width: 50%; | ||||
|  | } | ||||
|  | </style> | ||||
					Loading…
					
					
				
		Reference in new issue