|
1 | 1 | import type React from 'react' |
2 | 2 | import {useCallback} from 'react' |
3 | 3 | import {createRoot} from 'react-dom/client' |
4 | | -import {FocusKeys} from '@primer/behaviors' |
5 | | -import type {DialogProps, DialogHeaderProps, DialogButtonProps, DialogWidth, DialogHeight} from '../Dialog/Dialog' |
| 4 | +import type {DialogButtonProps, DialogWidth, DialogHeight} from '../Dialog/Dialog' |
6 | 5 | import {Dialog} from '../Dialog/Dialog' |
7 | | -import {useFocusZone} from '../hooks/useFocusZone' |
8 | 6 | import BaseStyles from '../BaseStyles' |
9 | | -import classes from './ConfirmationDialog.module.css' |
10 | | -import Heading from '../Heading' |
11 | 7 |
|
12 | 8 | /** |
13 | 9 | * Props to customize the ConfirmationDialog. |
@@ -81,39 +77,6 @@ export interface ConfirmationDialogProps { |
81 | 77 | height?: DialogHeight |
82 | 78 | } |
83 | 79 |
|
84 | | -const ConfirmationHeader: React.FC<React.PropsWithChildren<DialogHeaderProps>> = ({title, onClose, dialogLabelId}) => { |
85 | | - const onCloseClick = useCallback(() => { |
86 | | - onClose('close-button') |
87 | | - }, [onClose]) |
88 | | - |
89 | | - return ( |
90 | | - <div className={classes.ConfirmationHeader}> |
91 | | - <Heading id={dialogLabelId} as="h1" variant="small"> |
92 | | - {title} |
93 | | - </Heading> |
94 | | - <Dialog.CloseButton onClose={onCloseClick} /> |
95 | | - </div> |
96 | | - ) |
97 | | -} |
98 | | - |
99 | | -const ConfirmationBody: React.FC<React.PropsWithChildren<DialogProps>> = ({children}) => { |
100 | | - return <div className={classes.ConfirmationBody}>{children}</div> |
101 | | -} |
102 | | - |
103 | | -const ConfirmationFooter: React.FC<React.PropsWithChildren<DialogProps>> = ({footerButtons}) => { |
104 | | - const {containerRef: footerRef} = useFocusZone({ |
105 | | - bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.Tab, |
106 | | - focusInStrategy: 'closest', |
107 | | - }) |
108 | | - |
109 | | - // Must have exactly 2 buttons! |
110 | | - return ( |
111 | | - <div ref={footerRef as React.RefObject<HTMLDivElement>} className={classes.ConfirmationFooter}> |
112 | | - <Dialog.Buttons buttons={footerButtons ?? []} /> |
113 | | - </div> |
114 | | - ) |
115 | | -} |
116 | | - |
117 | 80 | /** |
118 | 81 | * A ConfirmationDialog is a special kind of dialog with more rigid behavior. It |
119 | 82 | * is used to confirm a user action. ConfirmationDialogs always have exactly |
@@ -168,9 +131,6 @@ export const ConfirmationDialog: React.FC<React.PropsWithChildren<ConfirmationDi |
168 | 131 | width={width} |
169 | 132 | height={height} |
170 | 133 | className={className} |
171 | | - renderHeader={ConfirmationHeader} |
172 | | - renderBody={ConfirmationBody} |
173 | | - renderFooter={ConfirmationFooter} |
174 | 134 | > |
175 | 135 | {children} |
176 | 136 | </Dialog> |
|
0 commit comments