sozsoft-platform/ui/src/components/template/ThemeConfigurator/ThemeConfigurator.tsx

63 lines
2 KiB
TypeScript
Raw Normal View History

2026-02-24 20:44:16 +00:00
import ModeSwitcher from './ModeSwitcher'
import LayoutSwitcher from './LayoutSwitcher'
import ThemeSwitcher from './ThemeSwitcher'
import DirectionSwitcher from './DirectionSwitcher'
import NavModeSwitcher from './NavModeSwitcher'
2026-03-27 13:49:15 +00:00
import StyleSwitcher from './StyleSwitcher'
2026-03-27 20:17:35 +00:00
import React, { useState, useCallback } from 'react'
import { useLocalization } from '@/utils/hooks/useLocalization'
2026-02-24 20:44:16 +00:00
export type ThemeConfiguratorProps = {
2026-03-27 13:49:15 +00:00
callBackClose?: () => void
2026-02-24 20:44:16 +00:00
}
2026-03-27 20:17:35 +00:00
2026-02-24 20:44:16 +00:00
const ThemeConfigurator = ({ callBackClose }: ThemeConfiguratorProps) => {
2026-03-27 13:49:15 +00:00
const { translate } = useLocalization()
2026-03-27 20:17:35 +00:00
const [modeKey, setModeKey] = useState(0)
2026-02-24 20:44:16 +00:00
2026-03-27 20:17:35 +00:00
// StyleSwitcher'dan tetiklenecek
const handleStyleChange = useCallback(() => {
setModeKey((prev) => prev + 1)
}, [])
2026-03-27 13:49:15 +00:00
return (
<div className="flex flex-col h-full justify-between">
2026-03-27 20:17:35 +00:00
<div className="flex flex-col gap-y-3 mb-2">
<div>
<h6 className="mb-3">{translate('::App.SiteManagement.Theme.Style')}</h6>
<StyleSwitcher onStyleChange={handleStyleChange} />
</div>
<div>
<h6 className="mb-3">{translate('::SidePanel.NavMode')}</h6>
<NavModeSwitcher />
</div>
<div>
<h6 className="mb-3">{translate('::SidePanel.Themed')}</h6>
<ThemeSwitcher />
</div>
2026-03-27 13:49:15 +00:00
<div className="flex items-center justify-between">
<div>
<h6>{translate('::SidePanel.Mode')}</h6>
<span>{translate('::SidePanel.Mode.Description')}</span>
</div>
2026-03-27 20:17:35 +00:00
<ModeSwitcher key={modeKey} />
2026-03-27 13:49:15 +00:00
</div>
<div className="flex items-center justify-between">
<div>
<h6>{translate('::SidePanel.Direction')}</h6>
<span>{translate('::SidePanel.Direction.Description')}</span>
</div>
<DirectionSwitcher callBackClose={callBackClose} />
</div>
<div>
<h6 className="mb-3">{translate('::SidePanel.Layout')}</h6>
<LayoutSwitcher />
</div>
</div>
</div>
)
2026-02-24 20:44:16 +00:00
}
export default ThemeConfigurator