MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ShadcnDialog

Function ShadcnDialog

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

closeFunction · 0.85

Tested by

no test coverage detected