@@ -101,84 +101,47 @@ export const WithPortalContext = () => {
101
101
< p > This story demonstrates how to use PortalContext to control where Portal content is rendered.</ p >
102
102
103
103
{ /* Default Portal */ }
104
- < div
105
- className = { clsx ( classes . PortalContainer , classes . InnerContainer ) }
106
- style = { { backgroundColor : '#f0f8ff' , margin : '10px' , padding : '10px' } }
107
- >
104
+ < div className = { clsx ( classes . PortalContainer , classes . DefaultSection ) } >
108
105
< strong > Default Portal (no context):</ strong >
109
106
{ mounted ? (
110
107
< Portal >
111
- < div style = { { backgroundColor : '#e6f3ff' , padding : '8px' , border : '1px solid #0366d6' } } >
112
- Content in default portal
113
- </ div >
108
+ < div className = { classes . DefaultPortalContent } > Content in default portal</ div >
114
109
</ Portal >
115
110
) : null }
116
111
</ div >
117
112
118
113
{ /* Portal with Context */ }
119
- < div
120
- className = { clsx ( classes . PortalContainer , classes . InnerContainer ) }
121
- style = { { backgroundColor : '#fff5f5' , margin : '10px' , padding : '10px' } }
122
- >
114
+ < div className = { clsx ( classes . PortalContainer , classes . ContextSection ) } >
123
115
< strong > Portal with PortalContext:</ strong >
124
116
< PortalContext . Provider value = { { portalContainerName : 'custom-portal' } } >
125
117
{ mounted ? (
126
118
< Portal >
127
- < div style = { { backgroundColor : '#ffe6e6' , padding : '8px' , border : '1px solid #d73a49' } } >
128
- Content in custom portal (via PortalContext)
129
- </ div >
119
+ < div className = { classes . ContextPortalContent } > Content in custom portal (via PortalContext)</ div >
130
120
</ Portal >
131
121
) : null }
132
122
</ PortalContext . Provider >
133
123
</ div >
134
124
135
125
{ /* Override context with containerName prop */ }
136
- < div
137
- className = { clsx ( classes . PortalContainer , classes . InnerContainer ) }
138
- style = { { backgroundColor : '#f0fff4' , margin : '10px' , padding : '10px' } }
139
- >
126
+ < div className = { clsx ( classes . PortalContainer , classes . OverrideSection ) } >
140
127
< strong > Context + containerName prop override:</ strong >
141
128
< PortalContext . Provider value = { { portalContainerName : 'custom-portal' } } >
142
129
{ mounted ? (
143
130
< Portal containerName = "override-portal" >
144
- < div style = { { backgroundColor : '#e6ffe6' , padding : '8px' , border : '1px solid #28a745' } } >
145
- Content overriding context with containerName prop
146
- </ div >
131
+ < div className = { classes . OverridePortalContent } > Content overriding context with containerName prop</ div >
147
132
</ Portal >
148
133
) : null }
149
134
</ PortalContext . Provider >
150
135
</ div >
151
136
</ div >
152
137
153
138
{ /* Custom portal containers */ }
154
- < div
155
- style = { {
156
- position : 'fixed' ,
157
- bottom : '10px' ,
158
- left : '10px' ,
159
- backgroundColor : '#fffbf0' ,
160
- padding : '10px' ,
161
- border : '2px solid #f66a0a' ,
162
- borderRadius : '4px' ,
163
- maxWidth : '200px' ,
164
- } }
165
- >
139
+ < div className = { classes . CustomPortalContainer } >
166
140
< strong > Custom Portal Container:</ strong >
167
141
< div ref = { customContainerRef } />
168
142
</ div >
169
143
170
- < div
171
- style = { {
172
- position : 'fixed' ,
173
- bottom : '10px' ,
174
- right : '10px' ,
175
- backgroundColor : '#f0fff0' ,
176
- padding : '10px' ,
177
- border : '2px solid #28a745' ,
178
- borderRadius : '4px' ,
179
- maxWidth : '200px' ,
180
- } }
181
- >
144
+ < div className = { classes . OverridePortalContainer } >
182
145
< strong > Override Portal Container:</ strong >
183
146
< div ref = { overrideContainerRef } />
184
147
</ div >
0 commit comments