[Refactor] WordFilter: Improve reusability of setting container templates.
This commit is contained in:
@@ -50,14 +50,14 @@ export const WordFilter = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
{ currentIsOpenedMicWordFilterList.data &&
|
{ currentIsOpenedMicWordFilterList.data && currentMicWordFilterList.data.length > 0 &&
|
||||||
<div className={styles.list_section_wrapper}>
|
<div className={styles.list_section_wrapper}>
|
||||||
{
|
{
|
||||||
currentMicWordFilterList.data.map((item, index) => {
|
currentMicWordFilterList.data.map((item, index) => {
|
||||||
return <WordFilterItem value={item} key={index} deleteAction={deleteAction}/>;
|
return <WordFilterItem value={item} key={index} deleteAction={deleteAction}/>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<div className={styles.entry_section_wrapper}>
|
<div className={styles.entry_section_wrapper}>
|
||||||
<_Entry width="30rem" onChange={onChangeEntry} ui_variable={input_value}/>
|
<_Entry width="30rem" onChange={onChangeEntry} ui_variable={input_value}/>
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.list_section_wrapper {
|
.list_section_wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
gap: 0.6rem;
|
gap: 0.6rem;
|
||||||
|
|||||||
@@ -22,13 +22,6 @@ import {
|
|||||||
} from "../_components";
|
} from "../_components";
|
||||||
import { Checkbox } from "@common_components";
|
import { Checkbox } from "@common_components";
|
||||||
|
|
||||||
const LabeledContainer = ({ children, label, desc, custom_class_name }) => (
|
|
||||||
<div className={clsx(styles.container, custom_class_name)}>
|
|
||||||
<LabelComponent label={label} desc={desc} />
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const useOnMouseLeaveDropdownMenu = () => {
|
export const useOnMouseLeaveDropdownMenu = () => {
|
||||||
const { updateIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu();
|
const { updateIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu();
|
||||||
|
|
||||||
@@ -49,19 +42,44 @@ export const DropdownMenuContainer = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CommonContainer = ({ Component, ...props }) => {
|
const CommonContainer = ({
|
||||||
|
label_type = "label_component",
|
||||||
|
add_break_point = true,
|
||||||
|
flex_column = false,
|
||||||
|
remove_border_bottom = false,
|
||||||
|
Component,
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
const { currentIsBreakPoint } = useStore_IsBreakPoint();
|
const { currentIsBreakPoint } = useStore_IsBreakPoint();
|
||||||
|
|
||||||
const container_class = clsx(styles.container, {
|
const container_class = clsx(styles.container, {
|
||||||
[styles.is_break_point]: props.add_break_point ?? currentIsBreakPoint.data,
|
[styles.is_break_point]: add_break_point && currentIsBreakPoint.data,
|
||||||
|
[styles.flex_column]: flex_column,
|
||||||
|
[styles.remove_border_bottom]: remove_border_bottom,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
if (label_type === "label_component") {
|
||||||
<LabeledContainer label={props.label} desc={props.desc} custom_class_name={container_class}>
|
return (
|
||||||
<Component {...props} is_break_point={currentIsBreakPoint.data} />
|
<div className={container_class}>
|
||||||
</LabeledContainer>
|
<LabelComponent label={props.label} desc={props.desc} />
|
||||||
);
|
<Component {...props} is_break_point={currentIsBreakPoint.data} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else if (label_type === "no_label") {
|
||||||
|
return (
|
||||||
|
<div className={container_class}>
|
||||||
|
<Component {...props} is_break_point={currentIsBreakPoint.data} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else if (label_type === "label_only") {
|
||||||
|
return (
|
||||||
|
<div className={container_class}>
|
||||||
|
<LabelComponent label={props.label} desc={props.desc} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SliderContainer = (props) => (
|
export const SliderContainer = (props) => (
|
||||||
<CommonContainer Component={Slider} {...props} />
|
<CommonContainer Component={Slider} {...props} />
|
||||||
);
|
);
|
||||||
@@ -114,19 +132,22 @@ export const ComputeDeviceContainer = (props) => (
|
|||||||
<CommonContainer Component={ComputeDevice} {...props} />
|
<CommonContainer Component={ComputeDevice} {...props} />
|
||||||
);
|
);
|
||||||
|
|
||||||
export const WordFilterContainer = (props) => (
|
export const WordFilterContainer = (props) => {
|
||||||
<div className={styles.word_filter_container}>
|
return (
|
||||||
<div className={styles.word_filter_switch_section}>
|
<>
|
||||||
<div className={styles.word_filter_label_wrapper}>
|
<CommonContainer
|
||||||
<LabelComponent label={props.label} desc={props.desc} />
|
Component={WordFilterListToggleComponent}
|
||||||
</div>
|
remove_border_bottom={true}
|
||||||
<WordFilterListToggleComponent />
|
{...props}
|
||||||
</div>
|
/>
|
||||||
<div className={styles.word_filter_section}>
|
<CommonContainer
|
||||||
<WordFilter {...props} />
|
Component={WordFilter}
|
||||||
</div>
|
label_type="no_label"
|
||||||
</div>
|
{...props}
|
||||||
);
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const DownloadModelsContainer = (props) => (
|
export const DownloadModelsContainer = (props) => (
|
||||||
<CommonContainer Component={DownloadModels} {...props} />
|
<CommonContainer Component={DownloadModels} {...props} />
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
&.flex_column {
|
&.flex_column {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
border-bottom: solid 0.1rem var(--dark_800_color);
|
&:not(.remove_border_bottom) {
|
||||||
|
border-bottom: solid 0.1rem var(--dark_800_color);
|
||||||
|
}
|
||||||
|
|
||||||
&.is_break_point {
|
&.is_break_point {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -33,25 +35,3 @@
|
|||||||
.message_format_section {
|
.message_format_section {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.word_filter_container {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: 2rem;
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.word_filter_switch_section {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.word_filter_label_wrapper {
|
|
||||||
max-width: 34rem;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user