11import { useState } from "react" ;
22import { Copy } from "lucide-react" ;
33import { twMerge } from "tailwind-merge" ;
4- import { useBreakpoint } from "@/hooks" ;
54import { ISTKData } from "@/types" ;
65import { IStyles } from "@/types/styles" ;
76import { stateToJSON } from "@/utils" ;
8- import { Button , IconButton } from "../core" ;
7+ import { Button , Tooltip , TooltipContent , TooltipTrigger } from "../core" ;
98
109interface IExportActionProps {
1110 text ?: string ;
@@ -15,7 +14,6 @@ interface IExportActionProps {
1514
1615const ExportAction : React . FC < IExportActionProps > = ( { text = "Export JSON" , onExport, styles } ) => {
1716 const [ loading , setLoading ] = useState ( false ) ;
18- const { md } = useBreakpoint ( ) ;
1917
2018 const onExportJson = ( ) => {
2119 const json = stateToJSON ( ) ;
@@ -34,29 +32,21 @@ const ExportAction: React.FC<IExportActionProps> = ({ text = "Export JSON", onEx
3432 }
3533 } ;
3634
37- if ( md )
38- return (
39- < Button
40- loading = { loading }
41- className = { twMerge ( styles ?. core ?. button ?. className ) }
42- style = { styles ?. core ?. button ?. properties }
43- onClick = { onExportJson }
44- variant = "secondary"
45- >
46- { text }
47- </ Button >
48- ) ;
49-
5035 return (
51- < IconButton
52- icon = { < Copy className = "w-5 h-5" /> }
53- label = { text }
54- onClick = { onExportJson }
55- loading = { loading }
56- className = { twMerge ( "w-10" , styles ?. core ?. button ?. className ) }
57- style = { styles ?. core ?. button ?. properties }
58- variant = "secondary"
59- />
36+ < Tooltip >
37+ < TooltipTrigger >
38+ < Button
39+ loading = { loading }
40+ className = { twMerge ( "w-10 md:w-auto px-2 md:px-4 transition-none" , styles ?. core ?. button ?. className ) }
41+ style = { styles ?. core ?. button ?. properties }
42+ onClick = { onExportJson }
43+ variant = "secondary"
44+ >
45+ < Copy className = "w-5 h-5 md:hidden" /> < span className = "hidden md:block" > { text } </ span >
46+ </ Button >
47+ </ TooltipTrigger >
48+ < TooltipContent className = "md:hidden" > { text } </ TooltipContent >
49+ </ Tooltip >
6050 ) ;
6151} ;
6252
0 commit comments