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

Function ShadcnDialog

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

closeFunction · 0.85

Tested by

no test coverage detected