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

[table] Adjust Truncated Popover Behavior #267

Merged
merged 3 commits into from
Nov 29, 2016

Conversation

themadcreator
Copy link
Contributor

@themadcreator themadcreator commented Nov 29, 2016

PR checklist

  • Enhancement
  • Includes tests

Changes

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.

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.
@themadcreator
Copy link
Contributor Author

Fixes #232

@@ -32,35 +48,42 @@ export interface ITruncatedFormatProps extends IProps {
* @default "..."
*/
truncationSuffix?: string;

Copy link
Contributor

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;
Copy link
Contributor

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;

Copy link
Contributor

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 {
Copy link
Contributor

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?

@blueprint-bot
Copy link

Missed one instance of old name

Preview: docs | table Coverage: core | datetime

@giladgray giladgray changed the title Adjust Truncated Popover Behavior [table] Adjust Truncated Popover Behavior Nov 29, 2016
switch (showPopover) {
case TruncatedPopoverMode.ALWAYS:
return true;
case TruncatedPopoverMode.NEVER:
Copy link
Contributor

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 😄

Copy link
Contributor Author

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

@themadcreator themadcreator merged commit e8d3db5 into master Nov 29, 2016
@themadcreator themadcreator deleted the bd/adjust-truncation-popover-behavior branch November 29, 2016 23:35
@llorca llorca mentioned this pull request Dec 2, 2016
greglo pushed a commit to greglo/blueprint that referenced this pull request Dec 12, 2016
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants