Skip to content

Commit db6c08e

Browse files
committed
force to hide elements regardless of container queries, add storybook items to control it
1 parent 716e2e1 commit db6c08e

2 files changed

Lines changed: 32 additions & 31 deletions

File tree

src/components/Pagination/Stories/Pagination.stories.tsx

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ export default {
1010

1111
const PaginationExample = (args) => <Pagination {...args} />;
1212

13+
const ContainerQueriesExample = (args) => (
14+
<>
15+
<Pagination {...args} style={{ maxWidth: "100%" }} />
16+
<Pagination {...args} style={{ maxWidth: "32rem" }} />
17+
<Pagination {...args} style={{ maxWidth: "26rem" }} />
18+
</>
19+
);
20+
1321
export const Default: StoryFn<typeof Pagination> = PaginationExample.bind({});
1422
Default.args = {
1523
pageSizes: [10, 20, 50, 100],
@@ -29,33 +37,26 @@ ExtendedPagesizeSelection.args = {
2937
],
3038
};
3139

32-
const VisibilityRegressionExample: StoryFn<typeof Pagination> = (args) => (
33-
<div style={{ display: "grid", gap: "1rem" }}>
34-
<p style={{ margin: 0, maxWidth: "56rem" }}>
35-
Both examples below enable <code>hidePageSizeConfiguration</code> and <code>hideNavigationArrows</code>.
36-
The expected behavior is that the page-size selector and navigation arrows stay hidden regardless of width.
37-
If the container-query override is active, the wider example will show them again.
38-
</p>
39-
<div style={{ display: "grid", gap: "1rem", gridTemplateColumns: "repeat(auto-fit, minmax(22rem, 1fr))" }}>
40-
<div style={{ border: "1px solid #c6c6c6", padding: "1rem" }}>
41-
<div style={{ fontWeight: 600, marginBottom: "0.5rem" }}>Narrow container (~24rem)</div>
42-
<div style={{ width: "24rem" }}>
43-
<Pagination {...args} />
44-
</div>
45-
</div>
46-
<div style={{ border: "1px solid #c6c6c6", padding: "1rem" }}>
47-
<div style={{ fontWeight: 600, marginBottom: "0.5rem" }}>Wide container (~36rem)</div>
48-
<div style={{ width: "36rem" }}>
49-
<Pagination {...args} />
50-
</div>
51-
</div>
52-
</div>
53-
</div>
54-
);
55-
56-
export const ContainerQueryOverridesHideFlags = VisibilityRegressionExample.bind({});
57-
ContainerQueryOverridesHideFlags.args = {
40+
/**
41+
* This story demonstrates a minimal pagination and is a check that elements are always hidden.
42+
*/
43+
export const MinimalPagination: StoryFn<typeof Pagination> = PaginationExample.bind({});
44+
MinimalPagination.args = {
5845
...Default.args,
5946
hidePageSizeConfiguration: true,
60-
hideNavigationArrows: true,
47+
hidePageSelect: true,
48+
hideInfoText: true,
49+
hideNavigationArrows: false,
50+
hideBorders: false,
51+
};
52+
53+
/**
54+
* Demonstrates the breakpoints of the container queries.
55+
* If the container gets too small, some elements are removed automatically.
56+
* First, page selector disappears, then the page size selector.
57+
* Info text and navigation arrow are never hidden automatically.
58+
*/
59+
export const ContainerQueries: StoryFn<typeof Pagination> = ContainerQueriesExample.bind({});
60+
ContainerQueries.args = {
61+
...Default.args,
6162
};

src/components/Pagination/pagination.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ span.#{$prefix}--pagination__text {
4040
padding-left: 0;
4141

4242
& > *:not(:last-child) {
43-
display: none;
43+
display: none !important;
4444
}
4545
}
4646
}
@@ -58,7 +58,7 @@ span.#{$prefix}--pagination__text {
5858

5959
.#{$eccgui}-pagination--hideinfotext {
6060
.#{$prefix}--pagination__left > .#{$prefix}--pagination__text:last-child {
61-
display: none;
61+
display: none !important;
6262
}
6363

6464
& .#{$prefix}--select__item-count .#{$prefix}--select-input {
@@ -68,13 +68,13 @@ span.#{$prefix}--pagination__text {
6868

6969
.#{$eccgui}-pagination--hidepageselect {
7070
.#{$prefix}--pagination__right > *:not(.#{$prefix}--pagination__control-buttons) {
71-
display: none;
71+
display: none !important;
7272
}
7373
}
7474

7575
.#{$eccgui}-pagination--hidenavigation {
7676
.#{$prefix}--pagination__right > .#{$prefix}--pagination__control-buttons {
77-
display: none;
77+
display: none !important;
7878
}
7979
}
8080

0 commit comments

Comments
 (0)