import React, { useEffect } from 'react' import { Button } from '../../Components/Button' import { Icon } from '../../Icons' import { CONTAINER_MAX_SIZE } from '../constants' const ActionBarComponent = ({ onlyMobile, children }: ActionBarProps) => { const [containerExpanded, setContainerExpanded] = React.useState(true) useEffect(() => { const botbar = window.parent.document.querySelector('.botbar') const container = window.document.querySelector( '.page-container' ) if (botbar) botbar.style.display = 'none' if (container) { container.classList.remove('lg:mb-10', 'lg:pb-0') setContainerExpanded(!!container.dataset.expanded) } return () => { if (botbar) botbar.style.display = '' if (container) container.classList.add('lg:mb-10', 'lg:pb-0') } }, []) return (
{!onlyMobile && (
{React.Children.map(children, ({ props }) => { const { ...childrenProps } = props delete childrenProps?.icon return
)}
{React.Children.map(children, ({ props }) => ( ))}
) } export const ActionBar = React.memo(ActionBarComponent) export interface ActionBarProps { /** Show component only on Mobile * @default false */ onlyMobile?: boolean /** * React children */ children: React.ReactElement | React.ReactElement[] }