-
Notifications
You must be signed in to change notification settings - Fork 2
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 Scrollbox container component #170
Conversation
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 added a few comments.
I would suggest to use the new <Scrollbox>
component in the LongModalExample
(DialogComponents.js
):
<Scrollbox>
<LoremIpsum />
</Scrollbox>
it('renders children inside of a div with appropriate classnames', () => { | ||
const wrapper = createComponent(); | ||
|
||
assert.isTrue(wrapper.find('div').first().hasClass('Hyp-Scrollbox')); |
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.
More consistent with the test below:
assert.isTrue(wrapper.find('div').first().hasClass('Hyp-Scrollbox')); | |
assert.isTrue(wrapper.find('div.Hyp-Scrollbox').exists()); |
it('applies extra classes', () => { | ||
const wrapper = createComponent({ classes: 'foo bar' }); | ||
|
||
assert.isTrue(wrapper.find('div.Hyp-Scrollbox.foo.bar').exists()); |
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.
If you want to check the correct class order, you can use this complicated test:
assert.isTrue(wrapper.find('div.Hyp-Scrollbox.foo.bar').exists()); | |
assert.deepEqual( | |
[ | |
...wrapper | |
.find('div.Hyp-Scrollbox.foo.bar') | |
.getDOMNode() | |
.classList.values(), | |
], | |
['Hyp-Scrollbox', 'foo', 'bar' ] | |
); |
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've added a note to #129 that could help to address this: I'd like to craft some common/reusable tests for components that take these common props.
* A sticky container that is sized one-touch-unit high. This is currently | ||
* expanded upon by table styling, but not used in other patterns (yet). | ||
*/ | ||
@mixin sticky-header { |
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.
@mixin sticky-header { | |
@mixin sticky-scrollbox-header { |
The association of the two names could help to understand when to use the pattern.
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.
You're right to note that this pattern isn't quite normalized where we need it yet. I spent a few minutes trying to see if I could re-jigger it (also taking the comment below about color into consideration), but the pattern lacks clarity out of context. What I'd like to propose is that we carry this forward into the next set of work, which involves a Table
component that uses the Scrollbox
component as a wrapper. Then we can scrutinize this pattern in better context and make some improvements.
@include layout.padding; | ||
@include atoms.border(bottom); | ||
|
||
background-color: var.$color-grey-1; |
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.
Maybe the colour could be taken out of this pattern, so the pattern only deals about positioning and size.
4f3edab
to
99f304c
Compare
6690d3c
to
56fad4e
Compare
Codecov Report
@@ Coverage Diff @@
## main #170 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 149 152 +3
Branches 51 53 +2
=========================================
+ Hits 149 152 +3
Continue to review full report at Codecov.
|
56fad4e
to
83090c8
Compare
This PR adds a
Scrollbox
container component based on thescrollbox
pattern. It also extracts a partial pattern for asticky-header
, as inspired by this comment in a previous PR. The only place a sticky header is currently used in our applications is in a table, so I haven't fully fleshed out this pattern, but it exists as a stub and the table-heading styling makes use of it now.This
Scrollbox
component will be used by forthcomingTable
component.You can see this component in action on the Container Components pattern-library page.
Depends on #169 as it builds on a pattern-library page modified in that branch.