Commit 71b8b370 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

Added configurable buttonBar title

parent aabd2355
......@@ -1155,6 +1155,7 @@
"subTitle": "Explore wiews institutes"
},
"display": {
"actions": "Browse or download data",
"title": "Institute details",
"type": "Type",
"webLink": "Web link",
......
......@@ -15,6 +15,7 @@
"subTitle": "Explore wiews institutes"
},
"display": {
"actions": "Browse or download data",
"title": "Institute details",
"type": "Type",
"webLink": "Web link",
......
......@@ -141,7 +141,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
</Properties>
<CardActions className="container-spacing-vertical mt-15">
<ButtonBar>
<ButtonBar barLabelText={ t('institutes.public.p.display.actions') }>
<Button onClick={ this.applyInstituteCodeFilter }>{ t('institutes.public.p.display.browseAccessions') }</Button>
<Button onClick={ this.applyFilterForOverview }>{ t('accessions.tab.overview') }</Button>
<Button onClick={ () => null }>{ `${t('common:action.download')} ${t('institutes.public.p.display.MCPD')}` }</Button>
......
......@@ -109,6 +109,7 @@ const styles = (theme) => ({
interface IButtonBarProps extends React.Props<any> {
classes?: any;
children?: any[];
barLabelText?: any;
}
class ButtonBar extends React.Component<IButtonBarProps, any> {
......@@ -116,7 +117,6 @@ class ButtonBar extends React.Component<IButtonBarProps, any> {
super(props);
this.state = {
anchorEl: null,
selectedIndex: 0,
};
}
......@@ -125,7 +125,7 @@ class ButtonBar extends React.Component<IButtonBarProps, any> {
}
private handleMenuItemClick = (event, index) => {
this.setState({ selectedIndex: index, anchorEl: null });
this.setState({ anchorEl: null });
}
private handleClose = () => {
......@@ -133,7 +133,7 @@ class ButtonBar extends React.Component<IButtonBarProps, any> {
}
public render() {
const { classes, children } = this.props;
const { classes, children, barLabelText } = this.props;
const { anchorEl } = this.state;
const childrenArr = React.Children.toArray(children);
......@@ -148,7 +148,7 @@ class ButtonBar extends React.Component<IButtonBarProps, any> {
aria-controls="button-menu"
onClick={ this.handleClickListItem }
>
<Button disabled className={ classes.firstAction }>{ childrenArr[this.state.selectedIndex] }</Button>
{ barLabelText && <Button disabled className={ classes.firstAction }>{ barLabelText }</Button> }
<ListItemIcon className={ `${classes.icon}` }>
<ReorderIcon />
</ListItemIcon>
......
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