@@ -56,20 +56,33 @@ const styles = theme => ({
56
56
margin : 'auto' ,
57
57
display : 'flex' ,
58
58
justifyContent : 'center' ,
59
+ [ theme . breakpoints . up ( 'sm' ) ] : {
60
+ borderRadius : theme . shape . borderRadius ,
61
+ } ,
62
+ } ,
63
+ /* Isolate the demo with an outline. */
64
+ demoBgOutlined : {
65
+ padding : theme . spacing ( 3 ) ,
66
+ border : `1px solid ${ fade ( theme . palette . action . active , 0.12 ) } ` ,
59
67
borderLeftWidth : 0 ,
60
68
borderRightWidth : 0 ,
61
- border : `1px solid ${ fade ( theme . palette . action . active , 0.12 ) } ` ,
62
- padding : theme . spacing ( 3 ) ,
63
69
[ theme . breakpoints . up ( 'sm' ) ] : {
64
- borderRadius : theme . shape . borderRadius ,
65
70
borderLeftWidth : 1 ,
66
71
borderRightWidth : 1 ,
67
72
} ,
68
73
} ,
69
- demoBg : {
70
- border : 'none' ,
74
+ /* Prepare the background to display an inner elevation. */
75
+ demoBgTrue : {
76
+ padding : theme . spacing ( 3 ) ,
71
77
backgroundColor : theme . palette . background . level2 ,
72
78
} ,
79
+ /* Make no difference between the demo and the markdown. */
80
+ demoBgInline : {
81
+ // Maintain alignment with the markdown text
82
+ [ theme . breakpoints . down ( 'xs' ) ] : {
83
+ padding : theme . spacing ( 3 ) ,
84
+ } ,
85
+ } ,
73
86
demoHiddenHeader : {
74
87
paddingTop : theme . spacing ( 2 ) ,
75
88
[ theme . breakpoints . up ( 'sm' ) ] : {
@@ -250,6 +263,10 @@ function Demo(props) {
250
263
[ demoOptions . height , demoOptions . maxWidth ] ,
251
264
) ;
252
265
266
+ if ( demoOptions . bg == null ) {
267
+ demoOptions . bg = 'outlined' ;
268
+ }
269
+
253
270
if ( demoOptions . iframe ) {
254
271
demoOptions . bg = true ;
255
272
}
@@ -298,7 +315,9 @@ function Demo(props) {
298
315
< div
299
316
className = { clsx ( classes . demo , {
300
317
[ classes . demoHiddenHeader ] : demoOptions . hideHeader ,
301
- [ classes . demoBg ] : demoOptions . bg ,
318
+ [ classes . demoBgOutlined ] : demoOptions . bg === 'outlined' ,
319
+ [ classes . demoBgTrue ] : demoOptions . bg === true ,
320
+ [ classes . demoBgInline ] : demoOptions . bg === 'inline' ,
302
321
} ) }
303
322
tabIndex = { - 1 }
304
323
onMouseEnter = { handleDemoHover }
0 commit comments