MCPcopy Create free account
hub / github.com/idosal/git-mcp / CodeExample

Function CodeExample

app/components/content.tsx:701–775  ·  view source on GitHub ↗
({
  code,
  id,
  name,
  popoutUrl,
}: {
  code: string;
  id: string;
  name: string;
  popoutUrl?: string;
})

Source from the content-addressed store, hash-verified

699}
700
701function CodeExample({
702 code,
703 id,
704 name,
705 popoutUrl,
706}: {
707 code: string;
708 id: string;
709 name: string;
710 popoutUrl?: string;
711}) {
712 return (
713 <div className="bg-slate-800 text-slate-100 p-3 rounded-md text-sm overflow-x-auto relative">
714 <button
715 onClick={() => {
716 navigator.clipboard.writeText(code);
717 const copyBtn = document.querySelector(`#${id}-copy-btn`);
718 if (copyBtn) {
719 copyBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-emerald-500"><polyline points="20 6 9 17 4 12"></polyline></svg>`;
720 setTimeout(() => {
721 copyBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`;
722 }, 2000);
723 }
724 }}
725 id={`${id}-copy-btn`}
726 className="absolute top-2 right-2 p-1 rounded-md hover:bg-slate-700 transition-colors focus:outline-none z-10"
727 aria-label="Copy code"
728 >
729 <svg
730 xmlns="http://www.w3.org/2000/svg"
731 width="16"
732 height="16"
733 viewBox="0 0 24 24"
734 fill="none"
735 stroke="currentColor"
736 strokeWidth="2"
737 strokeLinecap="round"
738 strokeLinejoin="round"
739 >
740 <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
741 <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
742 </svg>
743 </button>
744 {popoutUrl && (
745 <button
746 onClick={() => {
747 window.open(popoutUrl);
748 }}
749 id={`${id}-open-btn`}
750 className="absolute top-2 right-8 p-1 rounded-md hover:bg-slate-700 transition-colors focus:outline-none z-10"
751 aria-label={`Open ${name}`}
752 >
753 <svg
754 xmlns="http://www.w3.org/2000/svg"
755 width="16"
756 height="16"
757 viewBox="0 0 24 24"
758 fill="none"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected