import {BrowserRouter, BrowserRouterProps} from 'react-router'

import {TransitionContainer} from './transition-container'

type ShopMinisRouterProps = BrowserRouterProps & {
  viewTransitions?: boolean
}

export function MinisRouter({
  children,
  viewTransitions = false,
  ...props
}: ShopMinisRouterProps) {
  if (viewTransitions) {
    return (
      <BrowserRouter {...props}>
        <TransitionContainer>{children}</TransitionContainer>
      </BrowserRouter>
    )
  }

  return <BrowserRouter {...props}>{children}</BrowserRouter>
}
