Use the Queryable component Summary

This commit is contained in:
M. Mert Yildiran 2021-11-29 09:49:35 +03:00
parent d55aa2f10b
commit fb11d566b1
No known key found for this signature in database
GPG Key ID: D42ADB236521BF7A
4 changed files with 22 additions and 21 deletions

View File

@ -7,6 +7,7 @@ interface Props {
text: string | number,
query: string,
updateQuery: any,
title?: string,
textStyle?: object,
wrapperStyle?: object,
className?: string,
@ -17,7 +18,7 @@ interface Props {
onClick?: React.EventHandler<React.MouseEvent<HTMLElement>>;
}
const Queryable: React.FC<Props> = ({text, query, updateQuery, textStyle, wrapperStyle, className, isPossibleToCopy = true, applyTextEllipsis = true, useTooltip= false, displayIconOnMouseOver = false}) => {
const Queryable: React.FC<Props> = ({text, query, updateQuery, title, textStyle, wrapperStyle, className, isPossibleToCopy = true, applyTextEllipsis = true, useTooltip= false, displayIconOnMouseOver = false}) => {
const [showAddedNotification, setAdded] = useState(false);
const [showTooltip, setShowTooltip] = useState(false);
text = String(text);
@ -38,7 +39,7 @@ const Queryable: React.FC<Props> = ({text, query, updateQuery, textStyle, wrappe
// eslint-disable-next-line
}, [showAddedNotification]);
const textElement = <span className={'Queryable-Text'} style={textStyle}>{text}</span>;
const textElement = <span title={title} className={'Queryable-Text'} style={textStyle}>{text}</span>;
const copyButton = text ? <CopyToClipboard text={text} onCopy={onCopy}>
<span

View File

@ -1,6 +1,7 @@
import miscStyles from "./style/misc.module.sass";
import React from "react";
import styles from './style/Summary.module.sass';
import Queryable from "./Queryable";
interface SummaryProps {
method: string
@ -10,23 +11,24 @@ interface SummaryProps {
export const Summary: React.FC<SummaryProps> = ({method, summary, updateQuery}) => {
return <div className={styles.container}>
{method && <span
{method && <Queryable
text={method}
query={`method == "${method}"`}
updateQuery={updateQuery}
title="Method"
className={`queryable ${miscStyles.protocol} ${miscStyles.method}`}
onClick={() => {
updateQuery(`method == "${method}"`)
}}
>
{method}
</span>}
{summary && <div
className={`${miscStyles.protocol} ${miscStyles.method}`}
wrapperStyle={{height: "14px"}}
applyTextEllipsis={false}
displayIconOnMouseOver={true}
/>}
{summary && <Queryable
text={summary}
query={`summary == "${summary}"`}
updateQuery={updateQuery}
title="Summary"
className={`queryable ${styles.summary}`}
onClick={() => {
updateQuery(`summary == "${summary}"`)
}}
>
{summary}
</div>}
className={`${styles.summary}`}
applyTextEllipsis={false}
displayIconOnMouseOver={true}
/>}
</div>
};

View File

@ -3,6 +3,4 @@
align-items: center
.summary
text-overflow: ellipsis
overflow: hidden
white-space: nowrap

View File

@ -17,7 +17,7 @@
color: #a0b2ff
font-size: 10px
.noSelect
.noSelect
-webkit-touch-callout: none
-webkit-user-select: none
-khtml-user-select: none