Skip to content

Dark Themes does not work with React Admin Enterprise #596

@gplanchat

Description

@gplanchat

API Platform version(s) affected: @api-platform/admin 3.4.9

Description

It is not possible to configure the light and dark themes when using React Admin Enterprise, the Dark Theme parameters are lost in the process and we only get a broken standard dark theme on most parts of the application.

How to reproduce

import {HydraAdmin} from "@api-platform/admin"
import {houseDarkTheme, houseLightTheme} from "react-admin"
import {Admin} from "@react-admin/ra-enterprise"
import {SolarLayout} from "@react-admin/ra-navigation";

const GyroscopsLoader = ({ entrypoint, ...rest }: DashboardLoaderProps) => {
  return (
    <HydraAdmin
      admin={Admin}
      dataProvider={dataProvider}
      entrypoint={entrypoint}
      layout={SolarLayout}
      lightTheme={houseLightTheme}
      darkTheme={houseDarkTheme}
      defaultTheme="light"
      {{...rest}}
    >
   // Resources here
   </HydraAdmin>
  )
}

Possible Solution

In the AdminGuesser.tsx file, the AdminGuesser component does override anything we could set inside the darkTheme prop with the default APIP dark theme. It may be fixed by fixing this forced override.

Additional Context
#403

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions