mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-11 02:47:37 +03:00
34 lines
800 B
TypeScript
34 lines
800 B
TypeScript
|
|
import { useMemo } from "react";
|
||
|
|
import { ConfigSection } from "./BaseSection";
|
||
|
|
import type { BaseSectionProps, SectionConfig } from "./BaseSection";
|
||
|
|
import { getSectionConfig } from "@/utils/configUtil";
|
||
|
|
|
||
|
|
export type ConfigSectionTemplateProps = BaseSectionProps & {
|
||
|
|
sectionKey: string;
|
||
|
|
sectionConfig?: SectionConfig;
|
||
|
|
};
|
||
|
|
|
||
|
|
export function ConfigSectionTemplate({
|
||
|
|
sectionKey,
|
||
|
|
level,
|
||
|
|
sectionConfig,
|
||
|
|
...rest
|
||
|
|
}: ConfigSectionTemplateProps) {
|
||
|
|
const defaultConfig = useMemo(
|
||
|
|
() => getSectionConfig(sectionKey, level),
|
||
|
|
[sectionKey, level],
|
||
|
|
);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<ConfigSection
|
||
|
|
sectionPath={sectionKey}
|
||
|
|
defaultConfig={defaultConfig}
|
||
|
|
level={level}
|
||
|
|
sectionConfig={sectionConfig ?? defaultConfig}
|
||
|
|
{...rest}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export default ConfigSectionTemplate;
|