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

[k82] Add table styles #34

Merged
merged 9 commits into from
Jul 17, 2020
Merged

[k82] Add table styles #34

merged 9 commits into from
Jul 17, 2020

Conversation

travis-wb
Copy link
Contributor

@travis-wb travis-wb commented Jul 6, 2020

Summary

k82's staff-facing UI requires tables.
https://paper.dropbox.com/doc/Tables--A3H49z0w6_fBe746G5FDNyQ~Ag-cUlKW2nUBzFD9b9MgvLXm

Changes are documented in this peak-design-system PR:
WealthBar/peak-design-system#43

Scope

The scope of this addition is to cover the use case of k82: staff-facing desktop view. The above documentation contains a few such notes about k82 scope. Some aspects of the complete table design will be marked for completion ASAP after release of k82.

Testing

You should be able to mark up a table in Wealthbar and have these new styles work well.

  • text should be left-aligned, except:
    • you should be able to achieve right-aligned text in and <th> or <td> by applying the style .right
  • font size should be 1rem except:
    • <th> actually uses a smaller font size
    • you should be able to give the entire table smaller text by adding the class text-small
  • font weight should be normal, except:
    • <th> gets a bold text style
    • you should be able to achieve a bold style anywhere in a table by using the class .bold
  • rows should have a defualt light grey rollover style, except:
    • headers don't have a rollover style
    • adding class '.link-row` to a row should give it an alternative background colour
    • you should be able to create text that shows a green 'link' style by giving it the class .link-row-target

Screenshot of WIP table as it will be used in k82:
Screen Shot 2020-07-06 at 11 58 02 AM

Additionally, this new table style should not affect any existing table styles in WB. A PR was recently merged to solve known cases where it would interfere, if you find more please let me know

Submitter Checklist

  • Demo new or changed functionality to stakeholders
  • Perform self-review (see reviewer checklist)
  • Annotate MR with comments for reviewer
  • Document any new patterns or features on peak-design-system (will to ASAP after release of this PR)
  • Assign a team member who should specifically review this code
  • Address reviewer feedback, if any, and assign back to reviewer

Reviewer Checklist:

  • Version bump in package.json
  • Visually review significant UI changes
  • Assign @pez-wb as reviewer if needed
  • Assign back to submitter with feedback

@@ -1,6 +1,6 @@
{
"name": "@wealthbar/peak-style",
"version": "1.7.5",
"version": "2.0.0",
Copy link
Contributor Author

@travis-wb travis-wb Jul 6, 2020

Choose a reason for hiding this comment

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

since this styles the <table> element, it can be considered a breaking change. I've recently done a pre-remptive fix to try to prevent any breaks in WB.

&:hover { background-color: $neutral-50 }
}

th, td { padding: 0.5rem 0 0.5rem 0.5rem; }
Copy link
Contributor Author

@travis-wb travis-wb Jul 6, 2020

Choose a reason for hiding this comment

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

In a table you can't just slap padding on a <tr> so here we are

// TABLE VARIANT - smaller text
// this class can be applied to the <table> to shrink all text in the table
&.text-small {
font-size: 14px;
Copy link
Contributor

Choose a reason for hiding this comment

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

pixels! Not our favourite unit - rems?

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, thanks.

@travis-wb travis-wb changed the base branch from master to fix.css-files-regenerated July 6, 2020 21:17
@travis-wb travis-wb changed the base branch from fix.css-files-regenerated to master July 6, 2020 21:18
thead {
font-weight: bold;
border-bottom: 1px solid $neutral-300;
font-size: 14px;
Copy link
Contributor

Choose a reason for hiding this comment

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

0.875rem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link
Contributor

Choose a reason for hiding this comment

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

is it tho? 😛

// intended for use on a row to create a 'total' or 'summary' row style with bold text
.bold {
font-weight: bold;
}
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 this is already covered by the .strong class (global) in typography.scss

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right you are, removed it here and updated documentation accordingly

// this class can be applied to any <th> or <td>
.right {
text-align: right;
}
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 this could be globalized in the typography styles. Thoughts on that? (.center already exists there)

Copy link
Contributor Author

@travis-wb travis-wb Jul 7, 2020

Choose a reason for hiding this comment

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

Sounds gravy to me. I've made the update.
Note that .center is not documented anywhere on the typography page. I've not blazed that trail, but I've mentioned both in documentation for tables.

scss/base/tables.scss Outdated Show resolved Hide resolved
scss/base/tables.scss Outdated Show resolved Hide resolved
scss/base/tables.scss Show resolved Hide resolved
scss/base/tables.scss Outdated Show resolved Hide resolved
scss/base/tables.scss Show resolved Hide resolved

thead, th {
font-weight: bold;
font-size: 0.875rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

are table headers always going to be small ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

Copy link
Contributor

Choose a reason for hiding this comment

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

just saying this seems exactly like a thing a desinger is going to change in a comp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's in the design specs, I dunno what else to tell ya:
Screen Shot 2020-07-15 at 10 22 40 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. For my sanity can you check w/ Julian to make sure he wants ALL tables to have small headers (JIC)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now Julian-confirmed for sanity.

Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@travis-wb travis-wb requested a review from pez-work July 14, 2020 18:10
scss/base/tables.scss Outdated Show resolved Hide resolved
scss/base/tables.scss Outdated Show resolved Hide resolved
// TEXT VARIANT - hyperlink
// applying .link-row-target to a string will give it a link-like appearance
// when the mouse is hovered anywhere over the containing row
.link-row-target {
Copy link
Contributor

Choose a reason for hiding this comment

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

I get what is happening here with the targeted cell but this creates a scenario where the linked row has no visible "link" highlight text by default.

IMO it makes more sense to highlight (and underline! – it is a link) all text in the row by default and create a variant for the scenario where we only want to target one cell for highlight. Thoughts?

Copy link
Contributor Author

@travis-wb travis-wb Jul 14, 2020

Choose a reason for hiding this comment

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

I think it's easy to imagine a scenario in which a table has many coumns, and there's a need to be clear about where the link goes. For example on k82, the columns show date, client, bank number, and a recent comment. The link's target is specific to the bank numbers. There could be multiple rows for that client, but the two rows would not link to the same place, so it makes sense to emphasize the unique target of the link.

It is true that this makes it possible to mark up a table without a defualt emphasized string, but designers should understand the design pattern here and shouldn't ask us to do that. It's also possible to mark up a tab UI with tabs that contain no content, or mark up a page with a top-level h2 and then have subheadings as h1s. That doesn't mean design is going to ask us to do those things. There's no precedent that sets an expectation that wrong markup should be impossible.

Copy link
Contributor

Choose a reason for hiding this comment

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

but designers should understand the design pattern here and shouldn't ask us to do that.

LOL.

From an interaction perspective within Peak anything that is a link defaults to $primary and the text has SOME form of hover/focus activated state. Like literally everything has this — the original Peak team defined it as such.

My questions for Julian would be: why is this different? And, how does text read as a link? The hover state mirrors that of a "standard" table but with green as opposed to grey. If there was no hover state on standard tables there would be enough differentiation to read as a link, but because non-link tables have this feature it just reads (to me anyway) as a variant — cursor changes and too subtle and not enough.

If you want I can discuss this with Julian whaile you move on but I really think this is something that should be addressed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm hearing two concerns:
The 'contrast' concern - that the hover style has insufficient contrast.
The 'link' concern - that the link style can be incomplete if not used correctly.

Regarding the contrast: well we could measure it and see if it's up to accessibility standards.

Regarding the link: Can we think of any scenarios where applying the link style to EVERY column is a good idea? Example: You come across a table with columns date, client, bank number, and comment. They all look the same. What will happen when you click? Are you gonna see details about the client? Are you gonna see all activity for the date? Are you going to read the full version of the trancated column? Or, is each column linked separately? Will you go somewhere different depending hwich column you click on? You can't answer this question, so that's not a good solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

re: contrast: I'd say its more differentiation and readability as a link the contrast per se.
re:link: yes, want to avoid ambiguity of usage as much as possible.

I actually really like the example scenario you gave because it highlights an interesting point: Is applying the link style to EVERY column is a good idea?

In the case we have now we are doing exactly that — highlighting every column in a row and making the whole thing a click target. Where does it go? what AM I going to see? is it this? or that? When in fact it is really just one column or part of a column that is the "link".

Maybe this is being over designed and over built.

if a user sees a green text w/ underline are they going to assume the whole row is a link target by default? probably not unless we tell/infer that it is (which is what we are doing with this interaction). Looking at this:
linked-table

If we remove the row highlight, would the user not infer that the Desjardin -> Motus is the link? and really when THAT text highlights my gut would say ~80% of user would click on THAT text. I think this is a worth while interaction to get right and I think you make really valid points on this. TBH we should probably take this back to Julian and discuss the interaction and inference on this with him IMHO.

Copy link
Contributor Author

@travis-wb travis-wb Jul 15, 2020

Choose a reason for hiding this comment

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

Julian helped me measure the contrast: We aim to pass AA
Screen Shot 2020-07-15 at 10 35 20 AM


td {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is cell padding different on link rows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

design

Ultimately I could clarify with Julian if we need to know the exact rationale.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For what it's worth, the design around this has undergone a pretty rigorous design phase. It was designed for k82, then revisited for Peak which involed putting the full specs together and a review within the design department. Not to put too fine a point on it, but at this stage I'd like to gloss over this question.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok just seems odd to have a potentally different row in the mix…

@travis-wb travis-wb changed the base branch from master to fix.css-files-regenerated July 15, 2020 16:12
@travis-wb travis-wb changed the base branch from fix.css-files-regenerated to master July 15, 2020 16:12
@travis-wb travis-wb requested a review from pez-work July 15, 2020 16:14
Copy link
Contributor

@pez-work pez-work left a comment

Choose a reason for hiding this comment

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

a few minor comments but nothing cray. Maybe just verify w/ Julian on some of the implementation details.

scss/base/tables.scss Outdated Show resolved Hide resolved
scss/base/tables.scss Outdated Show resolved Hide resolved
scss/patterns/cards.scss Show resolved Hide resolved
scss/patterns/banners.scss Show resolved Hide resolved

thead, th {
font-weight: bold;
font-size: 0.875rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. For my sanity can you check w/ Julian to make sure he wants ALL tables to have small headers (JIC)

Copy link
Contributor

@pez-work pez-work left a comment

Choose a reason for hiding this comment

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

:shipit:

@travis-wb travis-wb merged commit be92079 into master Jul 17, 2020
@travis-wb travis-wb deleted the k82.table branch July 17, 2020 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants