/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //snap/lxd/current/share/lxd-ui/assets/CodeSnippetWithCopyButton-BMlK7djB.js
import{r as c,j as o,d as a,v as i}from"./index-B3cgCbnJ.js";const l=({value:t,children:e})=>{const[s,r]=c.useState(!1),p=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>{r(!1)},2e3)}catch(n){console.error(n)}};return navigator.clipboard===void 0?o.jsx(o.Fragment,{children:e}):o.jsxs("div",{className:"copy-to-clipboard-container",children:[o.jsx("div",{className:"u-truncate",children:e}),o.jsx(a.Button,{appearance:"base",type:"button",hasIcon:!0,dense:!0,className:"u-no-margin--bottom copy-to-clipboard-button","aria-label":s?"Copied to clipboard":"Copy to clipboard",onClick:p,children:s?o.jsx(a.Icon,{className:"copy-to-clipboard-button-wrapper",name:"task-outstanding"}):o.jsx(a.Tooltip,{message:"Copy",position:"top-center",className:"copy-to-clipboard-button-wrapper",zIndex:999,children:o.jsx(a.Icon,{name:"copy-to-clipboard"})})})]})},m=({code:t,className:e})=>o.jsx(a.CodeSnippet,{className:i("code-snippet-with-copy-button-wrapper",e),blocks:[{appearance:a.CodeSnippetBlockAppearance.LINUX_PROMPT,code:o.jsxs("div",{className:"command-wrapper",children:[o.jsx("span",{className:"command u-truncate",title:t,children:t}),o.jsx(l,{value:t})]})}]});export{m as C};
Copyright ©2k19 -
Hexid
|
Tex7ure