PluginProbe
Extendify / 0.2.0
Extendify v0.2.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / components / DevHelpers.js

DevHelpers.js in Extendify 0.2.0, at src/components/DevHelpers.js

33 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useEffect, useState } from '@wordpress/element'
2 import { CopyToClipboard } from 'react-copy-to-clipboard'
3 import { __ } from '@wordpress/i18n'
4
5 /** Overlay for pattern import button */
6 export const DevButtonOverlay = ({ template }) => {
7 const [idText, setIdText] = useState(template.id)
8
9 useEffect(() => {
10 if (idText === template.id) return
11 setTimeout(() => setIdText(template.id), 1000)
12 }, [idText, template.id])
13
14 return (
15 <div className="group-hover:opacity-90 opacity-0 flex space-x-2 items-center mb-2 ml-2 absolute bottom-0 left-0 transition duration-200 ease-in-out z-50">
16 <CopyToClipboard
17 text={template.id}
18 onCopy={() => setIdText(__('Copied...', 'extendify'))}>
19 <button className="bg-white border border-black p-2 rounded-md shadow-md cursor-pointer">
20 {idText}
21 </button>
22 </CopyToClipboard>
23 <a
24 target="_blank"
25 className="bg-white border font-semibold border-black p-2 rounded-md shadow-md no-underline text-black"
26 href={`https://airtable.com/appn5PSl8wU6X70sG/tblviYevlV5fYAEH7/viwh0L1kHmXN7FIB9/${template.id}`}
27 rel="noreferrer">
28 {__('Edit', 'extendify')}
29 </a>
30 </div>
31 )
32 }
33