@@ -4,7 +4,7 @@ import { Template as CloseButton } from "@spectrum-css/closebutton/stories/templ
4
4
import { Template as Modal } from "@spectrum-css/modal/stories/template.js" ;
5
5
import { Template as Typography } from "@spectrum-css/typography/stories/template.js" ;
6
6
import { Template as Underlay } from "@spectrum-css/underlay/stories/template.js" ;
7
- // import { getRandomId, renderContent } from "@spectrum-css/preview/decorators";
7
+ import { getRandomId , renderContent } from "@spectrum-css/preview/decorators" ;
8
8
import { html } from "lit" ;
9
9
import { classMap } from "lit/directives/class-map.js" ;
10
10
import { ifDefined } from "lit/directives/if-defined.js" ;
@@ -25,7 +25,7 @@ export const Template = ({
25
25
hasCheckbox = false ,
26
26
content = [ ] ,
27
27
customClasses = [ ] ,
28
- id,
28
+ id= getRandomId ( "dialog" ) ,
29
29
size = "m" ,
30
30
layout,
31
31
hasHeroImage = false ,
@@ -41,19 +41,19 @@ export const Template = ({
41
41
[ rootClass ] : true ,
42
42
[ `${ rootClass } --dismissible` ] : isDismissible && [ "fullscreen" , "fullscreenTakeover" ] . every ( l => layout !== l ) ,
43
43
[ `${ rootClass } --${ layout } ` ] : typeof layout !== "undefined" ,
44
- [ `${ rootClass } --size${ size ?. toUpperCase ( ) } ` ] : typeof size !== "undefined" ,
44
+ [ `${ rootClass } --size${ size ?. toUpperCase ( ) } ` ] : typeof size !== "undefined" ,
45
45
...customClasses . reduce ( ( a , c ) => ( { ...a , [ c ] : true } ) , { } ) ,
46
46
} ) }
47
47
id =${ ifDefined ( id ) }
48
48
role="dialog"
49
49
tabindex="-1"
50
50
aria-modal="true"
51
51
style=${ ifDefined ( styleMap ( customStyles ) ) }
52
- >
52
+ >
53
53
< div class ="${ rootClass } -grid ">
54
54
${ when ( hasHeroImage , ( ) =>
55
55
html `
56
- < div
56
+ < div
57
57
class ="spectrum-Dialog-hero "
58
58
style ="background-image:url(${ heroImageUrl ? heroImageUrl : "example-card-portrait.png" } ) ">
59
59
</ div >
@@ -65,17 +65,18 @@ export const Template = ({
65
65
` ) }
66
66
${ when ( header , ( ) => html `
67
67
< span class ="${ rootClass } -header-content ">
68
- ${ Typography ( {
68
+ ${ renderContent ( header ) }
69
+ <!-- ${ Typography ( {
69
70
semantics : "body" ,
70
71
size : "m" ,
71
72
// @todo : takeover dialogs can accept other components in their headers. could the renderContent function work here?
72
73
content : [ header ]
73
- } ) }
74
+ } ) } -->
74
75
</ span >
75
76
` ,
76
77
) }
77
78
</ div >
78
- < section class ="${ rootClass } -content "> ${ content . map ( ( c ) => ( typeof c === "function" ? c ( { } ) : c ) ) } </ section >
79
+ < section class ="${ rootClass } -content "> ${ renderContent ( content ) } </ section >
79
80
${ when ( isDismissible , ( ) =>
80
81
CloseButton ( {
81
82
customClasses : [ `${ rootClass } -closeButton` ] ,
@@ -114,12 +115,13 @@ export const Template = ({
114
115
label : footer ,
115
116
} ) }
116
117
` ,
117
- ( ) =>
118
- Typography ( {
119
- semantics : "body" ,
120
- size : "m" ,
121
- content : [ footer ]
122
- } )
118
+ ( ) =>
119
+ // Typography({
120
+ // semantics: "body",
121
+ // size: "m",
122
+ // content: [ footer ]
123
+ // })
124
+ renderContent ( footer )
123
125
) }
124
126
</ div >
125
127
< div class ="${ rootClass } -buttonGroup ">
@@ -141,7 +143,7 @@ export const Template = ({
141
143
} ,
142
144
} , context ) }
143
145
</ div >
144
- ` ,
146
+ ` ,
145
147
( ) => html `
146
148
< div class ="${ rootClass } -noFooter "> </ div >
147
149
< div class ="${ rootClass } -buttonGroup ">
0 commit comments