change menu image according to theme

Viewed 13

I have some images appearing on my home page. when changing the theme, i would like the image to change according to the theme, eg light theme, dark image. dark theme, light image. my const is like this:

 const getImage = (page, hover) => {
    switch (page) {
      case '/admin':
        return hover ? adminHover : admin;
      case '/props/list':
        return hover ? propsHover : proprs;
      case '/':
        return hover ? homeHover : home;
      case '/evnts':
        return hover ? eventHover : event;
 

I tried to put it this way:

const getImage = (page, hover) => {
    switch (page) {
      case '/admin':
        {
          theme === 'light' ? (
            admin
          ) : (
          adminHover
        )
        }

but it did not work. how could i do this?

0 Answers
Related