import { createContext, PropsWithChildren } from 'react';

import { LayoutDirection, Direction } from '../../common/direction';

export const DirectionContext = createContext<LayoutDirection>(Direction.LTR);

export type DirectionProviderProps = PropsWithChildren<{ direction: LayoutDirection }>;

export const DirectionProvider = ({ direction, children }: DirectionProviderProps) => {
  return <DirectionContext.Provider value={direction}>{children}</DirectionContext.Provider>;
};
