fix: react hook can't be used conditionally (#10439)
This commit is contained in:
@@ -121,11 +121,7 @@ const LayoutToggle = ({
|
||||
const isEmbed = typeof window !== "undefined" && window?.isEmbed?.();
|
||||
|
||||
const { t } = useLocale();
|
||||
// We don't want to show the layout toggle in embed mode as of now as it doesn't look rightly placed when embedded.
|
||||
// There is a Embed API to control the layout toggle from outside of the iframe.
|
||||
if (isEmbed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const layoutOptions = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
@@ -146,5 +142,11 @@ const LayoutToggle = ({
|
||||
].filter((layout) => enabledLayouts?.includes(layout.value as BookerLayouts));
|
||||
}, [t, enabledLayouts]);
|
||||
|
||||
// We don't want to show the layout toggle in embed mode as of now as it doesn't look rightly placed when embedded.
|
||||
// There is a Embed API to control the layout toggle from outside of the iframe.
|
||||
if (isEmbed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <ToggleGroup onValueChange={onLayoutToggle} defaultValue={layout} options={layoutOptions} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user