From 938d1ac436282d09400c6405071afc6984b53dc3 Mon Sep 17 00:00:00 2001 From: Elinor Date: Tue, 17 Nov 2020 18:40:48 +0300 Subject: [PATCH] Fix: focus order (#763) * restructure pivot items * add 'expand' and 'share' options as pivot items * add pivot items styling * Remove color * Add tooltips * remove unused function * add translateMessage function --- .../views/query-response/QueryResponse.tsx | 101 ++++++++---------- .../views/query-response/query-response.scss | 8 ++ 2 files changed, 54 insertions(+), 55 deletions(-) diff --git a/src/app/views/query-response/QueryResponse.tsx b/src/app/views/query-response/QueryResponse.tsx index 4544a0562..5f593a538 100644 --- a/src/app/views/query-response/QueryResponse.tsx +++ b/src/app/views/query-response/QueryResponse.tsx @@ -1,18 +1,22 @@ import { DefaultButton, FontSizes, - getId, IconButton, Modal, Pivot, - PrimaryButton, TooltipHost + getId, + Icon, + IconButton, Modal, Pivot, + PivotItem, + PrimaryButton, + TooltipHost } from 'office-ui-fabric-react'; import { Dialog, DialogFooter, DialogType } from 'office-ui-fabric-react/lib/Dialog'; import React, { Component } from 'react'; import { injectIntl } from 'react-intl'; import { connect } from 'react-redux'; -import { Mode } from '../../../types/enums'; import { IQueryResponseProps, IQueryResponseState } from '../../../types/query-response'; +import { translateMessage } from '../../utils/translate-messages'; import { copy } from '../common/copy'; import { createShareLink } from '../common/share'; -import { getPivotItems, onPivotItemClick } from './pivot-items/pivot-items'; +import { getPivotItems } from './pivot-items/pivot-items'; import './query-response.scss'; class QueryResponse extends Component { @@ -48,10 +52,29 @@ class QueryResponse extends Component this.setState({ showShareQueryDialog: !this.state.showShareQueryDialog }); }; - public toggleModal = () => { + public toggleExpandResponse = () => { this.setState({ showModal: !this.state.showModal }); } + public toggleModal = (event: any) => { + const { key } = event; + if (key && key.includes('expand')) { + this.toggleExpandResponse(); + } + if (key && key.includes('share')) { + this.handleShareQuery(); + } + } + + public renderItemLink(link: any) { + return ( + + + {link.headerText} + + ); + } + public render() { let body: any; let headers; @@ -76,55 +99,24 @@ class QueryResponse extends Component const pivotItems = getPivotItems(pivotProperties); return ( -
+
- {mode === Mode.Complete && <> -
- - - - -
- -
- - - -
- } onPivotItemClick(pivotItem)} - > + onLinkClick={this.toggleModal} + > {pivotItems} + +
@@ -132,7 +124,7 @@ class QueryResponse extends Component // @ts-ignore @@ -145,7 +137,7 @@ class QueryResponse extends Component }} iconProps={{ iconName: 'Cancel' }} ariaLabel='Close popup modal' - onClick={this.toggleModal} + onClick={this.toggleExpandResponse} /> {pivotItems} @@ -195,5 +187,4 @@ function mapStateToProps(state: any) { // @ts-ignore const WithIntl = injectIntl(QueryResponse); -export default connect(mapStateToProps)(WithIntl); - +export default connect(mapStateToProps)(WithIntl); \ No newline at end of file diff --git a/src/app/views/query-response/query-response.scss b/src/app/views/query-response/query-response.scss index f681149db..ae0c2d76d 100644 --- a/src/app/views/query-response/query-response.scss +++ b/src/app/views/query-response/query-response.scss @@ -14,6 +14,14 @@ width: 100%; } + .pivot-response *[data-content='Expand xx'] { + float: right !important; + } + + .pivot-response *[data-content='Share xx'] { + float: right !important; + } + .default-text { display: flex; width: 100%;