UNPKG

@opengis/fastify-table

Version:

core-plugins

14 lines (10 loc) 551 B
import buttonPreview from '../utils/buttonPreview.js'; import buttonDownload from '../utils/buttonDownload.js'; export default function buttonFilePreviewHelper(data, options = {}) { const { hash } = options; if (data && typeof data !== 'string') return 'wrong input data type'; if (!data) return ''; const preview = buttonPreview(data); const download = buttonDownload(data); return `<div class='flex gap-x-2'>${hash?.action === 'download' ? '' : preview}${hash?.action === 'preview' ? '' : download}</div>`; }