UNPKG

klioso

Version:

Multi-Service Provider Management System for WordPress and Web Development with Enhanced Scanner

2 lines (1 loc) 956 B
import{a,j as e,d as m}from"./app-DZ07njAd.js";import{B as l}from"./Button-D6Jcp-tA.js";function p({resource:h,resourceName:n,deleteRoute:i,variant:d="outline",size:c="sm",className:u="",onSuccess:o}){const[x,s]=a.useState(!1),[t,r]=a.useState(!1),f=()=>{r(!0),m.delete(i,{onSuccess:()=>{r(!1),s(!1),o&&o()},onError:()=>{r(!1)}})};return x?e.jsxs("div",{className:"flex flex-col gap-2 p-3 bg-red-50 border border-red-200 rounded",children:[e.jsxs("p",{className:"text-sm text-red-800",children:["Are you sure you want to delete this ",n,"?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(l,{onClick:f,disabled:t,size:"sm",className:"bg-red-600 hover:bg-red-700 text-white",children:t?"Deleting...":"Yes, Delete"}),e.jsx(l,{onClick:()=>s(!1),disabled:t,size:"sm",variant:"outline",children:"Cancel"})]})]}):e.jsx(l,{onClick:()=>s(!0),variant:d,size:c,className:`text-red-600 border-red-300 hover:bg-red-50 ${u}`,children:"Delete"})}export{p as D};