hypnagaga/docs/assets/Table-DhJ76JVj.js
github-actions[bot] 53dc84611c docs
2024-10-24 12:10:34 +00:00

2 lines
1.6 KiB
JavaScript

import{R as e,r as o}from"./index-DwChlhAQ.js";import{U as u}from"./index-D0unROMo.js";const E="_title_13v0c_1",d="_table_13v0c_31",s={title:E,table:d},y=t=>t.children.split(`
`).map(a=>e.createElement("div",{key:a},a)),b=t=>{const a=async l=>{const c=typeof l.copyable[l.column]=="function"?l.copyable[l.column](`${l.children}`):`${l.children}`;await navigator.clipboard.writeText(c),r(!0)},[n,r]=o.useState(!1);let m;return o.useEffect(()=>{m&&clearTimeout(m),m=setTimeout(()=>{r(!1)},1e3)},[n]),t.copyable&&t.copyable[t.column]?e.createElement("button",{className:"copy-btn",onClick:()=>a(t)},e.createElement("span",{className:"material-symbols-outlined"},"content_copy"),t.children,n&&e.createElement("div",{className:"copy-tag"},"Copied")):e.createElement(y,null,t.children)},f=t=>e.createElement("td",null,e.createElement(b,{...t},t.children)),h=t=>e.createElement("tr",null,t.children.map((a,n)=>e.createElement(f,{...t,column:n,key:n},a))),C=t=>e.createElement("th",null,t.children),v=({title:t=null,note:a=null,header:n,body:r,copyable:m,mdnLink:l=null})=>e.createElement(u,null,e.createElement("div",{className:s.title},t,t&&l&&e.createElement("a",{href:`https://developer.mozilla.org/en-US/docs/Web/CSS/${l}`,target:"_blank",rel:"noreferrer"},e.createElement("span",{className:"material-symbols-outlined"},"link")),a&&e.createElement("p",null,a)),e.createElement("table",{className:s.table},e.createElement("thead",null,e.createElement("tr",null,n.map(c=>e.createElement(C,{key:c},c)))),e.createElement("tbody",null,r.map((c,i)=>e.createElement(h,{title:t,header:n,body:r,copyable:m,mdnLink:l,key:i},c)))));export{v as C};