-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[table] Adjust Truncated Popover Behavior #267
Conversation
Previously, the `TruncatedFormat` cell would display a popover target with the "..." icon when its text content was longer than the `truncationLength` prop. Cells that weren't truncated this way used a CSS "text-overflow: ellipsis" rule, which lead to the odd sight of a mixture of "..." in the cells. This change alters the default behavior to always show the large "..." icon even if the cell's text content isn't truncated. Therefore the look of the cells will be much more consistent. Also, the `JSONFormat` cell will turn off the "..." popover target for nully values.
Fixes #232 |
@@ -32,35 +48,42 @@ export interface ITruncatedFormatProps extends IProps { | |||
* @default "..." | |||
*/ | |||
truncationSuffix?: string; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do we need this newline?
@@ -38,15 +38,28 @@ export class JSONFormat extends React.Component<IJSONFormatProps, {}> { | |||
|
|||
public render() { | |||
const { children, omitQuotesOnStrings, stringify } = this.props; | |||
|
|||
const isNully = children === undefined || children === null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the conventional style in Blueprint seems to be to do a double-equal comparison for null
/undefined
checks:
const isNully = children == null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== null
is the only valid case of double-equals cuz it performs both of the checks you've done here
@@ -10,6 +10,12 @@ import * as classNames from "classnames"; | |||
import * as PureRender from "pure-render-decorator"; | |||
import * as React from "react"; | |||
|
|||
export enum TruncatedPopover { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer a clearer noun here; the core
package has conditioned me to expect any Popover
to be a React component. Maybe something like TruncatedPopoverScheme
or TruncationScheme
?
switch (showPopover) { | ||
case TruncatedPopoverMode.ALWAYS: | ||
return true; | ||
case TruncatedPopoverMode.NEVER: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could get away without this case since it's also the default 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well we can, but i like to have all explicit enum values AND a default fallthrough
* Adjust Truncated Popover Behavior Previously, the `TruncatedFormat` cell would display a popover target with the "..." icon when its text content was longer than the `truncationLength` prop. Cells that weren't truncated this way used a CSS "text-overflow: ellipsis" rule, which lead to the odd sight of a mixture of "..." in the cells. This change alters the default behavior to always show the large "..." icon even if the cell's text content isn't truncated. Therefore the look of the cells will be much more consistent. Also, the `JSONFormat` cell will turn off the "..." popover target for nully values. * PR Comments * Missed one instance of old name
PR checklist
Changes
Previously, the
TruncatedFormat
cell would displaya popover target with the "..." icon when its text
content was longer than the
truncationLength
prop.Cells that weren't truncated this way used a CSS
"text-overflow: ellipsis" rule, which lead to
the odd sight of a mixture of "..." in the cells.
This change alters the default behavior to always
show the large "..." icon even if the cell's text
content isn't truncated. Therefore the look of the
cells will be much more consistent.
Also, the
JSONFormat
cell will turn off the"..." popover target for nully values.