| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
|
| 3 |
export const TourButton = ({ task, completed }) => { |
| 4 |
const startTour = (slug) => |
| 5 |
window.dispatchEvent( |
| 6 |
new CustomEvent('extendify-assist:start-tour', { |
| 7 |
detail: { tourSlug: slug }, |
| 8 |
}), |
| 9 |
); |
| 10 |
|
| 11 |
return ( |
| 12 |
<div className=""> |
| 13 |
<button |
| 14 |
type="button" |
| 15 |
className="hidden min-w-24 rounded-xs bg-design-main px-4 py-2.5 text-sm font-medium text-design-text hover:opacity-90 md:block" |
| 16 |
onClick={() => startTour(task.slug)} |
| 17 |
> |
| 18 |
{completed |
| 19 |
? task.buttonLabels.completed |
| 20 |
: task.buttonLabels.notCompleted} |
| 21 |
</button> |
| 22 |
<div className="rounded-xs border bg-gray-100 px-2 py-2 text-gray-700 sm:block md:hidden"> |
| 23 |
{__( |
| 24 |
'This tour is only available on desktop devices', |
| 25 |
'extendify-local', |
| 26 |
)} |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
); |
| 30 |
}; |
| 31 |
|