import * as React from 'react'; // @ts-ignore import dynamicReact from '@markdoc/markdoc/dist/react'; import { usePageSharedData } from '@portal/hooks'; import { Link } from '@portal/Link'; function slugify(text: string) { return text .toLowerCase() .replace(/ /g, '-') .replace(/[^\w-]+/g, ''); } export function IndexPageItems() { const data = usePageSharedData('index-page-items') as any[]; return (
); } export function StartStep(props: { children: React.ReactNode; stepIdx: number; steps: string[] }) { const stepLabel = props.steps[props.stepIdx]; const stepId = slugify(stepLabel); return (
    {props.steps.map((step, idx) => { const iterStepId = slugify(step).toLowerCase(); let className = `breadcrumb-item bc-${iterStepId}`; if (idx > 0) className += ' disabled'; if (iterStepId === stepId) className += ' current'; return (
  • {step}
  • ); })}
{dynamicReact(props.children, React, {})}
); } export function RepoLink(props: { children: React.ReactNode; path: string; github_fork: string; github_branch: string }) { const treeblob = props.path.indexOf(".") >= 0 ? "blob/" : "tree/" const sep = props.github_fork[-1] == "/" ? "" : "/" const href = props.github_fork+sep+treeblob+props.github_branch+"/"+props.path return ( {dynamicReact(props.children, React, {})} ) } export function CodePageName(props: { name: string; }) { return ( {props.name} ) }