use-is-ds-nav.tsx 677 B

1234567891011121314151617181920
  1. import { createContext, type FC, type ReactNode, useContext } from 'react'
  2. /**
  3. * This context wraps elements that should be styled according to the sidebar-navigation-ui-update redesign
  4. * It doesn't exactly match the split-test assignment because it's only used in the project-list page
  5. */
  6. const DsNavStyleContext = createContext<boolean | undefined>(undefined)
  7. export const DsNavStyleProvider: FC<
  8. React.PropsWithChildren<{
  9. children: ReactNode
  10. }>
  11. > = ({ children }) => (
  12. <DsNavStyleContext.Provider value>{children}</DsNavStyleContext.Provider>
  13. )
  14. export const useDsNavStyle = () => {
  15. const context = useContext(DsNavStyleContext)
  16. return context ?? false
  17. }