GetIt

tcmts.share.GetIt · #4qwjkw7g · term · runs anywhere

"Get it": a button that opens how to (React Aria's dialog, in a popover): the command that makes a codebase and pulls this one, to copy, and what comes after.

import { Chevron, CopyButton } from "#codebase/tcmts/share";
import { Button, Dialog, DialogTrigger, Heading, Popover } from "react-aria-components";

export function GetIt({ command, isPublic }: { command: string; isPublic: boolean }) {
  return (
    <DialogTrigger>
      <Button className="btn primary">
        Get it
        <Chevron />
      </Button>
      <Popover className="menu-pop getit" placement="bottom start" offset={6}>
        <Dialog className="getit-body">
          <Heading slot="title" className="getit-title">
            Get this codebase
          </Heading>
          <p className="muted">
            In an empty directory: make a codebase, point it at this server, and pull.
          </p>
          <div className="cmd">
            <pre className="code">{command}</pre>
            <CopyButton text={command} label="Copy" />
          </div>
          <p className="muted">
            {isPublic
              ? "Anyone can pull from this server."
              : "Pulling from this server takes a token: add --token <it> to tcm remote add."}{" "}
            To propose a change, make a branch, then <code>tcm contribute</code>.
          </p>
        </Dialog>
      </Popover>
    </DialogTrigger>
  );
}

uses

used by