11<script lang="ts" setup>
22import { computed } from " vue" ;
3- import { EVENT_TYPES } from " ../../types" ;
3+ import type { EventType } from " ../../types" ;
44import { IconSvg } from " ../icon-svg" ;
5+ import { DownloadType } from " ./types" ;
56
67type Props = {
7- eventType: EVENT_TYPES ;
8+ eventType: EventType | " unknown " ;
89 eventId: string ;
910 eventUrl: string ;
1011 tags: string [];
@@ -17,7 +18,7 @@ type Emits = {
1718 delete: [value : boolean ];
1819 toggleView: [value : boolean ];
1920 copy: [value : boolean ];
20- download: [value : boolean ];
21+ download: [value : DownloadType ];
2122 lock: [value : boolean ];
2223};
2324
@@ -40,8 +41,12 @@ const copyEvent = () => {
4041 emit (" copy" , true );
4142};
4243
43- const downloadEvent = () => {
44- emit (" download" , true );
44+ const downloadImageEvent = () => {
45+ emit (" download" , DownloadType .Image );
46+ };
47+
48+ const downloadFile = () => {
49+ emit (" download" , DownloadType .File );
4550};
4651
4752const lockEvent = () => {
@@ -76,14 +81,37 @@ const isVisibleTags = computed(() => props.tags.length > 0);
7681 </template >
7782 </div >
7883
79- <div v-if =" isVisibleControls" class =" preview-card-header__container" >
80- <button
81- class =" preview-card-header__button preview-card-header__button--copy"
82- @click =" downloadEvent"
83- @click.right.prevent =" copyEvent"
84- >
85- <IconSvg name =" copy" class =" preview-card-header__button-icon" />
86- </button >
84+ <div v-if =" isVisibleControls" class =" preview-card-header__buttons" >
85+ <div class =" preview-card-header__buttons-expand" >
86+ <button
87+ class =" preview-card-header__button preview-card-header__button--copy"
88+ @click =" copyEvent"
89+ >
90+ <IconSvg name =" copy" class =" preview-card-header__button-icon" />
91+ </button >
92+
93+ <div class =" preview-card-header__buttons-expand-list" >
94+ <button
95+ class =" preview-card-header__button preview-card-header__button--copy"
96+ @click =" downloadFile"
97+ >
98+ <IconSvg
99+ name =" file-download"
100+ class =" preview-card-header__button-icon"
101+ />
102+ </button >
103+
104+ <button
105+ class =" preview-card-header__button preview-card-header__button--copy"
106+ @click =" downloadImageEvent"
107+ >
108+ <IconSvg
109+ name =" image-download"
110+ class =" preview-card-header__button-icon"
111+ />
112+ </button >
113+ </div >
114+ </div >
87115
88116 <button
89117 class =" preview-card-header__button preview-card-header__button--collapse"
@@ -139,10 +167,6 @@ $eventTypeColorsMap: (
139167 @apply w-full flex sm :flex- row flex- col- reverse justify- between gap- y- 3;
140168}
141169
142- .preview-card-header__container {
143- @apply flex justify-end space-x- 2;
144- }
145-
146170.preview-card-header__tags {
147171 @apply flex flex-wrap gap- 3;
148172}
@@ -182,6 +206,35 @@ $eventTypeColorsMap: (
182206 }
183207}
184208
209+ .preview-card-header__buttons {
210+ @apply flex justify-end space-x- 2;
211+ }
212+
213+ .preview-card-header__buttons-expand {
214+ @apply relative left- [2px ] flex overflow-hidden border-x-2 rounded-3xl border-transparent dark :border- transparent cursor- pointer;
215+
216+ & :hover {
217+ @apply overflow-visible bg-gray-200 dark :bg- gray- 700 ring- 1 ring- gray- 200 dark :ring- gray- 700 border- gray- 200 dark :border- gray- 700;
218+ }
219+ }
220+
221+ .preview-card-header__buttons-expand-main {
222+ @apply space-x- 2;
223+ }
224+
225+ .preview-card-header__buttons-expand-list {
226+ @apply flex flex-row justify-end space-x-2 pr- 2;
227+ order : -1 ;
228+ width : 0 ;
229+ opacity : 0 ;
230+ transition : grid-template-columns , grid-template-rows 0.3s ease-in-out ;
231+
232+ .preview-card-header__buttons-expand :hover & {
233+ opacity : 1 ;
234+ width : auto ;
235+ }
236+ }
237+
185238.preview-card-header__button {
186239 @apply w-5 h-5 md :w- 4 md:h- 4 rounded- full opacity- 90 hover:opacity- 100 transition- all hover:ring- 4 ring- offset- 1;
187240 @apply text-white bg-gray-300 dark :bg- gray- 600 ring- blue- 200 dark :ring- blue- 800;
@@ -218,10 +271,14 @@ $eventTypeColorsMap: (
218271}
219272
220273.preview-card-header__button-icon {
221- @apply p-1 dark :fill- white;
274+ @apply p-0 .5 dark :fill- white;
275+
276+ .preview-card-header__button--collapse & {
277+ @apply p- 1;
278+ }
222279
223- .preview-card-header__button--lock & {
224- @apply p-0 .5 ;
280+ .preview-card-header__button--delete & {
281+ @apply p- 1 ;
225282 }
226283}
227284 </style >
0 commit comments