File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export const Turnstile = forwardRef<TurnstileInstance | undefined, TurnstileProp
12
12
onError,
13
13
id,
14
14
autoResetOnExpire = true ,
15
+ style,
15
16
...divProps
16
17
} = props
17
18
const config = options ?? { }
@@ -99,6 +100,9 @@ export const Turnstile = forwardRef<TurnstileInstance | undefined, TurnstileProp
99
100
'retry-interval' : config . retryInterval ?? 8000
100
101
}
101
102
103
+ const containerWidth = config . size === 'compact' ? '130px' : '300px'
104
+ const containerHeight = config . size === 'compact' ? '120px' : '65px'
105
+
102
106
const onLoadScript = ( ) => {
103
107
setScriptLoaded ( true )
104
108
}
@@ -151,7 +155,14 @@ export const Turnstile = forwardRef<TurnstileInstance | undefined, TurnstileProp
151
155
[ configJson , siteKey ]
152
156
)
153
157
154
- return < div ref = { containerRef } id = { containerId } { ...divProps } />
158
+ return (
159
+ < div
160
+ ref = { containerRef }
161
+ id = { containerId }
162
+ style = { { width : containerWidth , height : containerHeight , ...style } }
163
+ { ...divProps }
164
+ />
165
+ )
155
166
} )
156
167
157
168
Turnstile . displayName = 'Turnstile'
You can’t perform that action at this time.
0 commit comments