MCPcopy
hub / github.com/primer/react / CustomHeader

Function CustomHeader

packages/react/src/Dialog/Dialog.features.stories.tsx:60–80  ·  view source on GitHub ↗
({
  title,
  subtitle,
  dialogLabelId,
  dialogDescriptionId,
  onClose,
}: React.PropsWithChildren<DialogProps & {dialogLabelId: string; dialogDescriptionId: string}>)

Source from the content-addressed store, hash-verified

58}
59
60function CustomHeader({
61 title,
62 subtitle,
63 dialogLabelId,
64 dialogDescriptionId,
65 onClose,
66}: React.PropsWithChildren<DialogProps & {dialogLabelId: string; dialogDescriptionId: string}>) {
67 const onCloseClick = useCallback(() => {
68 onClose('close-button')
69 }, [onClose])
70 if (typeof title === 'string' && typeof subtitle === 'string') {
71 return (
72 <Box bg="accent.subtle">
73 <h1 id={dialogLabelId}>{title.toUpperCase()}</h1>
74 <h2 id={dialogDescriptionId}>{subtitle.toLowerCase()}</h2>
75 <Dialog.CloseButton onClose={onCloseClick} />
76 </Box>
77 )
78 }
79 return null
80}
81function CustomBody({children}: React.PropsWithChildren<DialogProps>) {
82 return <Dialog.Body sx={{bg: 'danger.subtle'}}>{children}</Dialog.Body>
83}

Callers

nothing calls this directly

Calls 1

onCloseFunction · 0.85

Tested by

no test coverage detected