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

Add left and right shadows to indicate that the table is horizontally scrollable #58

Merged
merged 2 commits into from
Oct 7, 2016
Merged

Add left and right shadows to indicate that the table is horizontally scrollable #58

merged 2 commits into from
Oct 7, 2016

Conversation

ljin-dev
Copy link
Contributor

@ljin-dev ljin-dev commented Oct 5, 2016

Added shadows to the table on both left and right sides to indicate the table is horizontally scrollable.

Description

When a table has many columns, horizontal scrollbar shows up to allow users to scroll horizontally to the right or the left to view columns on the two ends. The change adds shadows to one or both sides to indicate if there are columns not being exposed thus the table can be scrolled to view them.

Motivation and Context

Due to user experience tests, horizontal scrollbars are not clear enough to users that the they can scroll horizontally to view columns on the sides that are currently hidden. Having shadows makes it more clear and users can easily understand if they have hidden columns that they need to scroll to view.

How Has This Been Tested?

Very minor JavaScript code change and some simply CSS style change.

Manual testing only. No automated test. It has been tested in IE11+ (Win10), Edge(Win10), Chrome (MacOS), Safari(MacOS), Firefox(MacOS).

No impact on other area of the code is expected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@KamranAsif
Copy link
Contributor

Can you include some screenshots?

@KamranAsif KamranAsif self-assigned this Oct 6, 2016
'fixedDataTableRowLayout/fixedColumnsDivider': left > 0,
'fixedDataTableRowLayout/columnsShadow': this.props.scrollLeft > 0,
'public/fixedDataTableRow/fixedColumnsDivider': left > 0,
'public/fixedDataTableRow/columnsShadow': this.props.scrollLeft > 0,
Copy link
Contributor

@KamranAsif KamranAsif Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent looks off here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

'fixedDataTableRowLayout/columnsShadow': true,
'fixedDataTableRowLayout/columnsRightShadow': true,
'public/fixedDataTableRow/columnsShadow': true,
'public/fixedDataTableRow/columnsRightShadow': true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do cx('class1', 'class2', ...);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

},

_renderColumnsRightShadow(/*number*/ totalWidth) /*?object*/ {
if (this.props.scrollLeft + this.props.width + 0.5 < totalWidth) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is 0.5 magic number here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use 'Math.ceil' to roundup the value so it's more readable. There is a chance the shadow doesn't show nicely at an edgy case otherwise.

.public/fixedDataTableRow/columnsRightShadow {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have postcss as part of the build step, so you don't need to manually include all prefixes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary prefixes.

left: left,
height: this.props.height
};
console.log("left shadow: ", className);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@KamranAsif
Copy link
Contributor

LGTM, thanks!

@KamranAsif KamranAsif merged commit b68269e into schrodinger:master Oct 7, 2016
@ljin-dev
Copy link
Contributor Author

ljin-dev commented Oct 7, 2016

Screenshots added

  • original: there is no shadows on the right hand even column 3 is partially hidden and the horizontal scrollbar appears

original

  • new: a narrow shadow appears on the right hand to indicate it's horizontally scrollable to the right to expose column 3 completely

new

  • new: the shadow on the right disappears when it's been scrolled to the right and column 3 is completely exposed

new2

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.

None yet

2 participants