MCPcopy Index your code
hub / github.com/adobe/react-spectrum / ShadcnDialog

Function ShadcnDialog

packages/dev/s2-docs/src/CodePlatter.tsx:386–424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384));
385
386function ShadcnDialog() {
387 let {type, component} = useContext(ShadcnContext)!;
388 let preRef = useRef<HTMLPreElement | null>(null);
389
390 return (
391 <Dialog size="L">
392 {({close}) => (
393 <>
394 <Heading slot="title">Install with shadcn</Heading>
395 <Content>
396 <p>
397 Use the{' '}
398 <Link href="https://ui.shadcn.com/docs/cli" target="_blank" rel="noopener noreferrer">
399 shadcn CLI
400 </Link>{' '}
401 to install {component} and its dependencies into your project.
402 </p>
403 <ShadcnCommand type={type} component={component} preRef={preRef} />
404 </Content>
405 <ButtonGroup>
406 <Button variant="secondary" slot="close">
407 Cancel
408 </Button>
409 <Button
410 variant="accent"
411 onPress={() => {
412 navigator.clipboard.writeText(preRef.current!.textContent!).catch(() => {
413 ToastQueue.negative('Failed to copy command. Please try again.');
414 });
415 close();
416 }}>
417 Copy and close
418 </Button>
419 </ButtonGroup>
420 </>
421 )}
422 </Dialog>
423 );
424}
425
426// function CodeSandboxDialog({getExampleFiles, codeRef, files, urls, entry, deps, type}) {
427// return (

Callers

nothing calls this directly

Calls 1

closeFunction · 0.85

Tested by

no test coverage detected