Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: (fix) Tooltip component styling and props #46854

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pkg/ui/src/components/tooltip/tooltip.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
@require '~src/components/core/index.styl'

.tooltip-overlay
max-width max-content
.ant-tooltip-content
width 500px
.ant-tooltip-inner
@extend $text--body
line-height $line-height--small
Expand Down
6 changes: 3 additions & 3 deletions pkg/ui/src/components/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export interface TooltipProps {
}

export function Tooltip(props: TooltipProps & AntTooltipProps) {
const { children, theme } = props;
const classes = cn("tooltip-overlay", `crl-tooltip--theme-${theme}`);
const { children, theme, overlayClassName } = props;
const classes = cn("tooltip-overlay", `crl-tooltip--theme-${theme}`, overlayClassName);
return (
<AntTooltip
{...props}
mouseEnterDelay={0.5}
overlayClassName={classes}
{...props}
>
{children}
</AntTooltip>
Expand Down
11 changes: 8 additions & 3 deletions pkg/ui/src/views/jobs/jobDescriptionCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ export class JobDescriptionCell extends React.PureComponent<{ job: Job }> {
return (
<Link className={`${additionalStyle}`} to={`jobs/${String(job.id)}`}>
<div className="cl-table-link__tooltip">
<Tooltip arrowPointAtCenter placement="bottom" title={
<pre style={{whiteSpace: "pre-wrap"}} className="cl-table-link__description">{description}</pre>
}>
<Tooltip
arrowPointAtCenter
placement="bottom"
title={
<pre style={{whiteSpace: "pre-wrap"}} className="cl-table-link__description">{description}</pre>
}
overlayClassName="cl-table-link__statement-tooltip--fixed-width"
>
<div className="jobs-table__cell--description">{job.statement || job.description}</div>
</Tooltip>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ export function DiagnosticStatusBadge(props: OwnProps) {

return (
<Tooltip
visible={enableTooltip}
title={tooltipContent}
theme="blue"
placement="bottom"
placement="bottomLeft"
>
<div
className="diagnostic-status-badge__content"
Expand Down
5 changes: 5 additions & 0 deletions pkg/ui/src/views/statements/statements.styl
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,8 @@ $plan-node-attribute-key-color = #37a806 // light green
text-decoration underline
._text-bold
font-family RobotoMono-Bold

.cl-table-link__statement-tooltip--fixed-width
max-width max-content
.ant-tooltip-content
max-width 500px
10 changes: 7 additions & 3 deletions pkg/ui/src/views/statements/statementsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ function StatementLink(props: { statement: string, app: string, implicitTxn: boo
return (
<Link to={ `${base}/${encodeURIComponent(props.statement)}` }>
<div className="cl-table-link__tooltip">
<Tooltip placement="bottom" title={
<pre className="cl-table-link__description">{ getHighlightedText(props.statement, props.search) }</pre>
}>
<Tooltip
placement="bottom"
title={<pre className="cl-table-link__description">
{ getHighlightedText(props.statement, props.search) }
</pre>}
overlayClassName="cl-table-link__statement-tooltip--fixed-width"
>
<div className="cl-table-link__tooltip-hover-area">
{ getHighlightedText(shortStatement(summary, props.statement), props.search, true) }
</div>
Expand Down