|
|
|
@ -5,6 +5,10 @@ import { Icon, Icons } from "@/components/Icon";
@@ -5,6 +5,10 @@ import { Icon, Icons } from "@/components/Icon";
|
|
|
|
|
import { Heading1 } from "@/components/utils/Text"; |
|
|
|
|
|
|
|
|
|
const availableThemes = [ |
|
|
|
|
{ |
|
|
|
|
id: "default", |
|
|
|
|
key: "settings.appearance.themes.default", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: "blue", |
|
|
|
|
key: "settings.appearance.themes.blue", |
|
|
|
@ -26,6 +30,7 @@ const availableThemes = [
@@ -26,6 +30,7 @@ const availableThemes = [
|
|
|
|
|
function ThemePreview(props: { |
|
|
|
|
selector?: string; |
|
|
|
|
active?: boolean; |
|
|
|
|
inUse?: boolean; |
|
|
|
|
name: string; |
|
|
|
|
onClick?: () => void; |
|
|
|
|
}) { |
|
|
|
@ -105,7 +110,7 @@ function ThemePreview(props: {
@@ -105,7 +110,7 @@ function ThemePreview(props: {
|
|
|
|
|
<span |
|
|
|
|
className={classNames( |
|
|
|
|
"inline-block px-3 py-1 leading-tight text-sm transition-opacity duration-150 rounded-full bg-pill-activeBackground text-white/85", |
|
|
|
|
props.active ? "opacity-100" : "opacity-0 pointer-events-none", |
|
|
|
|
props.inUse ? "opacity-100" : "opacity-0 pointer-events-none", |
|
|
|
|
)} |
|
|
|
|
> |
|
|
|
|
{t("settings.appearance.activeTheme")} |
|
|
|
@ -117,6 +122,7 @@ function ThemePreview(props: {
@@ -117,6 +122,7 @@ function ThemePreview(props: {
|
|
|
|
|
|
|
|
|
|
export function ThemePart(props: { |
|
|
|
|
active: string | null; |
|
|
|
|
inUse: string | null; |
|
|
|
|
setTheme: (theme: string | null) => void; |
|
|
|
|
}) { |
|
|
|
|
const { t } = useTranslation(); |
|
|
|
@ -126,16 +132,11 @@ export function ThemePart(props: {
@@ -126,16 +132,11 @@ export function ThemePart(props: {
|
|
|
|
|
<Heading1 border>{t("settings.appearance.title")}</Heading1> |
|
|
|
|
<div className="grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-6 max-w-[700px]"> |
|
|
|
|
{/* default theme */} |
|
|
|
|
<ThemePreview |
|
|
|
|
name={t("settings.appearance.themes.default")} |
|
|
|
|
selector="theme-default" |
|
|
|
|
active={props.active === null} |
|
|
|
|
onClick={() => props.setTheme(null)} |
|
|
|
|
/> |
|
|
|
|
{availableThemes.map((v) => ( |
|
|
|
|
<ThemePreview |
|
|
|
|
selector={`theme-${v.id}`} |
|
|
|
|
active={props.active === v.id} |
|
|
|
|
inUse={props.inUse === v.id} |
|
|
|
|
name={t(v.key)} |
|
|
|
|
key={v.id} |
|
|
|
|
onClick={() => props.setTheme(v.id)} |
|
|
|
|