File tree Expand file tree Collapse file tree 5 files changed +26
-12
lines changed
test/integration/next-appdir Expand file tree Collapse file tree 5 files changed +26
-12
lines changed Original file line number Diff line number Diff line change 163163 "./Footer" : " ./dist/Footer.js" ,
164164 "./Download" : " ./dist/Download.js" ,
165165 "./Display" : " ./dist/Display.js" ,
166- "./ConsentBannerNext" : " ./dist/ConsentBannerNext/index.js" ,
167166 "./ConsentBanner" : " ./dist/ConsentBanner/index.js" ,
168167 "./Checkbox" : " ./dist/Checkbox.js" ,
169168 "./Card" : " ./dist/Card.js" ,
Original file line number Diff line number Diff line change @@ -434,10 +434,8 @@ export const Footer = memo(
434434 : [
435435 id < FooterProps . BottomItem > ( {
436436 "text" : t ( "cookies management" ) ,
437- "buttonProps" : {
438- onClick : cookiesManagementButtonProps . onClick ,
439- ...cookiesManagementButtonProps . nativeButtonProps
440- }
437+ "buttonProps" :
438+ cookiesManagementButtonProps . nativeButtonProps
441439 } )
442440 ] ) ,
443441 ...bottomItems
Original file line number Diff line number Diff line change @@ -223,11 +223,15 @@ export function createModal<Name extends string>(params: {
223223 function InternalModal ( props : ModalProps ) {
224224 return (
225225 < >
226- { isOpenedByDefault && (
227- < Button { ...openModalButtonProps } className = { fr . cx ( "fr-hidden" ) } >
228- { " " }
229- </ Button >
230- ) }
226+ < Button
227+ nativeButtonProps = { {
228+ ...openModalButtonProps . nativeButtonProps ,
229+ "id" : hiddenControlButtonId
230+ } }
231+ className = { fr . cx ( "fr-hidden" ) }
232+ >
233+ { " " }
234+ </ Button >
231235 < Modal { ...props } id = { modalId } />
232236 </ >
233237 ) ;
@@ -238,6 +242,8 @@ export function createModal<Name extends string>(params: {
238242 overwriteReadonlyProp ( InternalModal as any , "name" , InternalModal . displayName ) ;
239243
240244 function openModal ( ) {
245+ console . log ( "wesh!" ) ;
246+
241247 const hiddenControlButton = document . getElementById ( hiddenControlButtonId ) ;
242248
243249 assert ( hiddenControlButton !== null , "Modal isn't mounted" ) ;
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export default function Page() {
133133 ] }
134134 />
135135 < ClientComponent />
136- < Button { ...simpleModalButtonProps } > Open simple modal</ Button >
136+ < Button { ...simpleModalButtonProps } > Open simple modal (control button) </ Button >
137137 < SimpleModal
138138 title = "simple modal title"
139139 buttons = {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as React from 'react';
44import Stack from '@mui/material/Stack' ;
55import Button from '@mui/material/Button' ;
66import { useIsDark } from "@codegouvfr/react-dsfr/useIsDark" ;
7+ import { createModal } from "@codegouvfr/react-dsfr/Modal" ;
78
89export function ClientComponent ( ) {
910
@@ -17,6 +18,16 @@ export function ClientComponent() {
1718 < Button variant = "outlined" > Outlined</ Button >
1819 </ Stack >
1920 < p > Is dark? { isDark ? "yes" : "no" } </ p >
21+ < Button onClick = { openClientModal } > Open client modal</ Button >
22+ < ClientModal title = "Client modal" >
23+ < p > Client modal content</ p >
24+ < button onClick = { closeClientModal } > Close</ button >
25+ </ ClientModal >
2026 </ >
2127 ) ;
22- }
28+ }
29+
30+ const { ClientModal, openClientModal, closeClientModal } = createModal ( {
31+ "isOpenedByDefault" : false ,
32+ "name" : "client"
33+ } ) ;
You can’t perform that action at this time.
0 commit comments