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

Function DefaultHeader

packages/react/src/Dialog/Dialog.tsx:350–371  ·  view source on GitHub ↗
({
  dialogLabelId,
  title,
  subtitle,
  dialogDescriptionId,
  onClose,
})

Source from the content-addressed store, hash-verified

348`
349
350const DefaultHeader: React.FC<React.PropsWithChildren<DialogHeaderProps>> = ({
351 dialogLabelId,
352 title,
353 subtitle,
354 dialogDescriptionId,
355 onClose,
356}) => {
357 const onCloseClick = useCallback(() => {
358 onClose('close-button')
359 }, [onClose])
360 return (
361 <Dialog.Header>
362 <Box display="flex">
363 <Box display="flex" px={2} py="6px" flexDirection="column" flexGrow={1}>
364 <Dialog.Title id={dialogLabelId}>{title ?? 'Dialog'}</Dialog.Title>
365 {subtitle && <Dialog.Subtitle id={dialogDescriptionId}>{subtitle}</Dialog.Subtitle>}
366 </Box>
367 <Dialog.CloseButton onClose={onCloseClick} />
368 </Box>
369 </Dialog.Header>
370 )
371}
372const DefaultBody: React.FC<React.PropsWithChildren<DialogProps>> = ({children}) => {
373 return <Dialog.Body>{children}</Dialog.Body>
374}

Callers

nothing calls this directly

Calls 1

onCloseFunction · 0.85

Tested by

no test coverage detected