Commit 2175ab83 authored by Imran Salam's avatar Imran Salam
Browse files

make all of track panel list item clickable when drawer is opened

parent ad2f73dc
......@@ -99,6 +99,7 @@ const TrackPanel: FunctionComponent<TrackPanelProps> = (
<Fragment>
<TrackPanelList
browserRef={props.browserRef}
drawerOpened={props.drawerOpened}
drawerView={props.drawerView}
launchbarExpanded={props.launchbarExpanded}
objectInfo={props.objectInfo}
......
......@@ -17,6 +17,7 @@ import styles from './TrackPanelList.scss';
type TrackPanelListProps = {
browserRef: RefObject<HTMLDivElement>;
drawerOpened: boolean;
drawerView: string;
launchbarExpanded: boolean;
objectInfo: any;
......@@ -95,10 +96,11 @@ const TrackPanelList: FunctionComponent<TrackPanelListProps> = (
const getTrackListItem = (track: TrackPanelItem) => (
<TrackPanelListItem
browserRef={props.browserRef}
drawerOpened={props.drawerOpened}
drawerView={props.drawerView}
updateDrawerView={changeDrawerView}
key={track.id}
track={track}
updateDrawerView={changeDrawerView}
>
{track.childTrackList &&
track.childTrackList.map((childTrack: TrackPanelItem) =>
......
......@@ -20,6 +20,7 @@ import styles from './TrackPanelListItem.scss';
type TrackPanelListItemProps = {
browserRef: RefObject<HTMLDivElement>;
children?: ReactNode[];
drawerOpened: boolean;
drawerView: string;
track: TrackPanelItem;
updateDrawerView: (drawerView: string) => void;
......@@ -62,7 +63,17 @@ const TrackPanelListItem: FunctionComponent<TrackPanelListItemProps> = (
return classNames;
};
const changeDrawerViewHandler = () => {
const drawerViewListHandler = (event: MouseEvent) => {
event.preventDefault();
if (props.drawerOpened === false) {
return;
}
props.updateDrawerView(props.track.name);
};
const drawerViewButtonHandler = () => {
props.updateDrawerView(props.track.name);
};
......@@ -89,7 +100,7 @@ const TrackPanelListItem: FunctionComponent<TrackPanelListItemProps> = (
return (
<Fragment>
<dd className={getListItemClasses()}>
<dd className={getListItemClasses()} onClick={drawerViewListHandler}>
<label>
{track.color && <span className={getBoxClasses(track.color)} />}
<span className={styles.mainText}>{track.label}</span>
......@@ -110,7 +121,7 @@ const TrackPanelListItem: FunctionComponent<TrackPanelListItemProps> = (
</button>
)}
</label>
<button onClick={changeDrawerViewHandler}>
<button onClick={drawerViewButtonHandler}>
<img src={ellipsis.icon.on} alt={`Go to ${track.label}`} />
</button>
<button onClick={toggleTrack}>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment