opened tabs widget

This commit is contained in:
Jan Prochazka
2020-04-13 13:49:00 +02:00
parent 0e395f14ad
commit abb3f6e09c
6 changed files with 112 additions and 44 deletions

View File

@@ -0,0 +1,22 @@
import React from 'react';
import _ from 'lodash';
import { getIconImage } from '../icons';
const openedTabAppObject = () => ({ tabid, props, selected, icon, title }, { setOpenedTabs }) => {
const key = tabid;
const Icon = (props) => getIconImage(icon, props);
const isBold = !!selected;
const onClick = () => {
setOpenedTabs((files) =>
files.map((x) => ({
...x,
selected: x.tabid == tabid,
}))
);
};
return { title, key, Icon, isBold, onClick };
};
export default openedTabAppObject;