@@ -88,16 +88,8 @@ function CanvasContainer(props: CanvasContainerProps): JSX.Element {
88
88
state . components [ 0 ] . children . length > 0 &&
89
89
components . scrollHeight == components . clientHeight
90
90
) {
91
- console . log ( 'if components scroll height' , components . scrollHeight ) ;
92
- console . log ( 'if components client height' , components . clientHeight ) ;
93
- console . log ( 'if container scroll height' , container . scrollHeight ) ;
94
- console . log ( 'if container client height' , container . clientHeight ) ;
95
91
container . scrollTop = 0 ;
96
92
} else if ( container && components ) {
97
- console . log ( 'else components scroll height' , components . scrollHeight ) ;
98
- console . log ( 'else components client height' , components . clientHeight ) ;
99
- console . log ( 'else container scroll height' , container . scrollHeight ) ;
100
- console . log ( 'else container client height' , container . clientHeight ) ;
101
93
container . scrollTop = container . scrollHeight ;
102
94
}
103
95
} , [ state . components [ 0 ] . children . length , zoom ] ) ;
@@ -126,40 +118,41 @@ function CanvasContainer(props: CanvasContainerProps): JSX.Element {
126
118
< Button style = { codePreviewStyle } onClick = { onClickCodePreview } >
127
119
Code Preview
128
120
</ Button >
129
- < div >
130
- < Button
131
- style = { backToTop }
132
- onClick = { ( ) => {
133
- container . scrollTop = 0 ;
134
- } }
135
- >
136
- Scroll Top
137
- </ Button >
138
- < Button
139
- style = { backToTop }
140
- onClick = { ( ) => {
141
- container . scrollTop = container . clientHeight ;
142
- } }
143
- >
144
- Scroll Bottom
145
- </ Button >
146
- </ div >
121
+ { ! state . codePreview && (
122
+ < div >
123
+ < Button
124
+ style = { backToTop }
125
+ onClick = { ( ) => {
126
+ container . scrollTop = 0 ;
127
+ } }
128
+ >
129
+ Scroll Top
130
+ </ Button >
131
+ < Button
132
+ style = { backToTop }
133
+ onClick = { ( ) => {
134
+ container . scrollTop = container . clientHeight ;
135
+ } }
136
+ >
137
+ Scroll Bottom
138
+ </ Button >
139
+ </ div >
140
+ ) }
147
141
< Button style = { buttonStyle } onClick = { zoomIn } >
148
142
< ZoomIn />
149
143
</ Button >
150
144
< Button style = { buttonStyle } onClick = { zoomOut } >
151
145
< ZoomOut />
152
146
</ Button >
153
147
</ div >
154
- { state . codePreview && (
148
+ { state . codePreview ? (
155
149
< CodePreview
156
150
theme = { theme }
157
151
setTheme = { setTheme }
158
152
zoom = { zoom }
159
153
containerRef = { containerRef }
160
154
/>
161
- ) }
162
- { ! state . codePreview && (
155
+ ) : (
163
156
< Canvas
164
157
zoom = { zoom }
165
158
ref = { containerRef } /*isThemeLight={props.isThemeLight} */
0 commit comments