File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1- <script setup>
1+ <script setup lang="ts">
2+ import LucideCopy from ' ~icons/lucide/copy'
3+ import { Button } from ' frappe-ui'
4+
25defineProps ({
36 data: {
47 type: Array ,
@@ -10,6 +13,10 @@ const formatColor = (color) => {
1013 const arr = color .split (' -' )
1114 return arr .slice (2 ).join (' -' )
1215}
16+
17+ const copyToClipboard = (txt : string ) => {
18+ navigator .clipboard .writeText (txt )
19+ }
1320 </script >
1421
1522<template >
@@ -32,11 +39,18 @@ const formatColor = (color) => {
3239 class =" rounded size-20"
3340 :style =" { backgroundColor: color.value }"
3441 ></div >
35- <span
36- class =" whitespace-nowrap bg-surface-gray-2 p-1 py-1.5 text-sm rounded-sm text-center w-20"
37- >
38- {{ formatColor(color.name) }}
39- </span >
42+
43+ <Button class =" group relative" @click =" copyToClipboard(color.name)" >
44+ <span
45+ class =" absolute flex items-center inset-0 justify-center gap-1 opacity-0 transition-opacity duration-150 group-hover:opacity-100"
46+ >
47+ <LucideCopy class =" size-4" /> Copy
48+ </span >
49+
50+ <span class =" transition-opacity duration-150 group-hover:opacity-0" >
51+ {{ formatColor(color.name) }}
52+ </span >
53+ </Button >
4054 </div >
4155 </template >
4256 </div >
You can’t perform that action at this time.
0 commit comments