File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,10 +100,6 @@ const Alert = ({
100100 values = { [
101101 [ HeadingContext , { className : styles . heading } ] ,
102102 [ ButtonGroupContext , { className : styles . buttonGroup } ] ,
103- // Establish Alert's own Text context so an ancestor overlay (e.g. a Dialog,
104- // which sets a `subtitle` slot with its own id/elementType/CSS) cannot leak
105- // into Alert content. Provides a default slot so a bare <Text> works, plus a
106- // `subtitle` slot for backward compatibility with existing usage.
107103 [
108104 TextContext ,
109105 {
Original file line number Diff line number Diff line change 6969 grid-column : 1 / span 2 ;
7070 }
7171
72+ > [slot = 'header' ] {
73+ margin-bottom : var (--lp-size-20 );
74+ }
75+
7276 & [slot = 'header' ] {
7377 display : grid;
7478 grid-template-columns : 1fr ;
Original file line number Diff line number Diff line change @@ -47,20 +47,20 @@ const renderModal = (args: Story['args']) => (
4747 < Button > Trigger</ Button >
4848 < ModalOverlay >
4949 < Modal { ...args } >
50+ < div slot = "header" >
51+ < Heading slot = "title" > Title</ Heading >
52+ < IconButton
53+ aria-label = "close"
54+ icon = "cancel"
55+ size = "small"
56+ variant = "minimal"
57+ onPress = { close }
58+ />
59+ < Text slot = "subtitle" > Subtitle</ Text >
60+ </ div >
5061 < Dialog >
5162 { ( { close } ) => (
5263 < >
53- < div slot = "header" >
54- < Heading slot = "title" > Title</ Heading >
55- < IconButton
56- aria-label = "close"
57- icon = "cancel"
58- size = "small"
59- variant = "minimal"
60- onPress = { close }
61- />
62- < Text slot = "subtitle" > Subtitle</ Text >
63- </ div >
6464 < div slot = "body" > Body text</ div >
6565 < div slot = "footer" >
6666 < Button slot = "close" > Cancel</ Button >
@@ -112,26 +112,31 @@ export const Drawer: Story = {
112112 } ,
113113} ;
114114
115+ /**
116+ * A Modal with a slotted `header`. The `header` groups the `title`, an optional
117+ * `subtitle`, and the close button into the overlay's header grid, separate from the
118+ * `body` and `footer`.
119+ */
115120export const WithHeader : Story = {
116121 render : ( args ) => (
117122 < DialogTrigger >
118123 < Button > Trigger</ Button >
119124 < ModalOverlay >
120125 < Modal { ...args } >
126+ < div slot = "header" >
127+ < Heading slot = "title" > Invite teammates</ Heading >
128+ < IconButton
129+ aria-label = "close"
130+ icon = "cancel"
131+ size = "small"
132+ variant = "minimal"
133+ onPress = { close }
134+ />
135+ < Text slot = "subtitle" > They'll get an email with a link to join.</ Text >
136+ </ div >
121137 < Dialog >
122138 { ( { close } ) => (
123139 < >
124- < div slot = "header" >
125- < Heading slot = "title" > Invite teammates</ Heading >
126- < IconButton
127- aria-label = "close"
128- icon = "cancel"
129- size = "small"
130- variant = "minimal"
131- onPress = { close }
132- />
133- < Text slot = "subtitle" > They'll get an email with a link to join.</ Text >
134- </ div >
135140 < div slot = "body" > Body text</ div >
136141 < div slot = "footer" >
137142 < Button slot = "close" > Cancel</ Button >
You can’t perform that action at this time.
0 commit comments