From b21a46e96eda0782673d03ff17866f887a6fa72a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 11 Nov 2025 03:02:21 +0900 Subject: [PATCH] [Refactor] Extract container logic into TemplatesContainerWrapper. --- .../setting_box/_templates/Templates.jsx | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx index b74b9f2f..a8ef6b6c 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx @@ -42,6 +42,27 @@ export const DropdownMenuContainer = (props) => { ); }; +const TemplatesContainerWrapper = ({ + children, + add_break_point = true, + flex_column = false, + remove_border_bottom = false, +}) => { + const { currentIsBreakPoint } = useStore_IsBreakPoint(); + + const container_class = clsx(styles.container, { + [styles.is_break_point]: add_break_point && currentIsBreakPoint.data, + [styles.flex_column]: flex_column, + [styles.remove_border_bottom]: remove_border_bottom, + }); + + return ( +
+ {children} +
+ ); +}; + const CommonContainer = ({ label_type = "label_component", add_break_point = true, @@ -52,34 +73,35 @@ const CommonContainer = ({ }) => { const { currentIsBreakPoint } = useStore_IsBreakPoint(); - const container_class = clsx(styles.container, { - [styles.is_break_point]: add_break_point && currentIsBreakPoint.data, - [styles.flex_column]: flex_column, - [styles.remove_border_bottom]: remove_border_bottom, - }); + const container_wrapper_props = { + add_break_point: add_break_point, + flex_column: flex_column, + remove_border_bottom: remove_border_bottom, + }; if (label_type === "label_component") { return ( -
+ -
+ ); } else if (label_type === "no_label") { return ( -
+ -
+ ); } else if (label_type === "label_only") { return ( -
+ -
+ ); } }; + export const SliderContainer = (props) => ( ); @@ -108,19 +130,14 @@ export const RadioButtonContainer = (props) => ( ); export const DeeplAuthKeyContainer = (props) => { - const { currentIsBreakPoint } = useStore_IsBreakPoint(); - const container_class = clsx(styles.container, { - [styles.is_break_point]: currentIsBreakPoint.data, - }); - return ( -
+
-
+ ); };