2021-12-11 14:04:05 +01:00
|
|
|
import themes from 'shared/themes/index.js'
|
2021-12-30 14:23:02 +01:00
|
|
|
import ThemeIcon from 'shared/components/icons/theme.js'
|
2021-12-11 14:04:05 +01:00
|
|
|
|
2022-01-22 17:55:03 +01:00
|
|
|
const ThemePicker = ({ app, className }) => {
|
2021-12-11 14:04:05 +01:00
|
|
|
return (
|
2021-12-30 18:17:10 +01:00
|
|
|
<div className={`dropdown ${className}`}>
|
2021-12-30 18:53:56 +01:00
|
|
|
<div tabIndex="0" className={`
|
|
|
|
m-0 btn btn-neutral flex flex-row gap-2
|
|
|
|
sm:btn-ghost
|
|
|
|
hover:bg-neutral hover:border-neutral-content
|
|
|
|
`}>
|
2021-12-30 14:23:02 +01:00
|
|
|
<ThemeIcon />
|
2022-01-22 17:55:03 +01:00
|
|
|
<span>{app.i18n
|
|
|
|
? app.t(`${app.theme}Theme`)
|
|
|
|
: `${app.theme} Theme`
|
|
|
|
}</span>
|
2021-12-30 14:23:02 +01:00
|
|
|
</div>
|
2022-01-22 17:55:03 +01:00
|
|
|
<ul
|
|
|
|
tabIndex="0"
|
|
|
|
className="p-2 shadow menu dropdown-content bg-base-100 rounded-box w-52"
|
|
|
|
>
|
2021-12-30 14:23:02 +01:00
|
|
|
{Object.keys(themes).map(theme => (
|
|
|
|
<li key={theme}>
|
2022-01-22 17:55:03 +01:00
|
|
|
<button
|
|
|
|
onClick={() => app.setTheme(theme)}
|
2022-02-05 22:01:01 +01:00
|
|
|
className="btn btn-ghost hover:bg-base-200"
|
2022-01-22 17:55:03 +01:00
|
|
|
>
|
2022-02-05 22:01:01 +01:00
|
|
|
<span className="text-base-content">
|
|
|
|
{app.i18n
|
|
|
|
? app.t(`${theme}Theme`)
|
|
|
|
: `${theme} Theme`
|
|
|
|
}
|
|
|
|
</span>
|
2021-12-30 14:23:02 +01:00
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2021-12-11 14:04:05 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ThemePicker
|