execute designed query

This commit is contained in:
Jan Prochazka
2020-12-29 18:44:28 +01:00
parent 290acdb68a
commit 4962d81661
6 changed files with 59 additions and 26 deletions

View File

@@ -62,7 +62,7 @@ export function TabPage({ key, label, children }) {
return children;
}
export function TabControl({ children, activePageIndex = undefined }) {
export function TabControl({ children, activePageIndex = undefined, activePageLabel = undefined }) {
const [value, setValue] = React.useState(0);
// const [mountedTabs, setMountedTabs] = React.useState({});
@@ -73,6 +73,13 @@ export function TabControl({ children, activePageIndex = undefined }) {
if (activePageIndex != null) setValue(activePageIndex);
}, [activePageIndex]);
React.useEffect(() => {
if (activePageLabel != null) {
const pageIndex = _.findIndex(childrenArray, (x) => x.props.label == activePageLabel);
if (pageIndex >= 0) setValue(pageIndex);
}
}, [activePageLabel]);
const theme = useTheme();
// // cleanup closed tabs