-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[CL-473] Adjust popup page max width and scroll containers #14853
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
base: main
Are you sure you want to change the base?
Changes from all commits
2f2d832
d9a8013
a5e9e84
437e749
36a26d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
// FIXME: Update this file to be type safe and remove this and next line | ||
// @ts-strict-ignore | ||
Comment on lines
-1
to
-2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. โ |
||
import { ScrollingModule } from "@angular/cdk/scrolling"; | ||
import { CommonModule } from "@angular/common"; | ||
import { Component, importProvidersFrom } from "@angular/core"; | ||
import { RouterModule } from "@angular/router"; | ||
|
@@ -40,6 +39,17 @@ | |
}) | ||
class ExtensionContainerComponent {} | ||
|
||
@Component({ | ||
selector: "extension-popped-container", | ||
template: ` | ||
<div class="tw-h-[640px] tw-w-[900px] tw-border tw-border-solid tw-border-secondary-300"> | ||
<ng-content></ng-content> | ||
</div> | ||
`, | ||
standalone: true, | ||
}) | ||
class ExtensionPoppedContainerComponent {} | ||
|
||
@Component({ | ||
selector: "vault-placeholder", | ||
template: /*html*/ ` | ||
|
@@ -318,6 +328,7 @@ | |
CommonModule, | ||
RouterModule, | ||
ExtensionContainerComponent, | ||
ExtensionPoppedContainerComponent, | ||
MockBannerComponent, | ||
MockSearchComponent, | ||
MockVaultSubpageComponent, | ||
|
@@ -328,6 +339,11 @@ | |
MockVaultPagePoppedComponent, | ||
NoItemsModule, | ||
VaultComponent, | ||
ScrollingModule, | ||
ItemModule, | ||
SectionComponent, | ||
IconButtonModule, | ||
BadgeModule, | ||
], | ||
providers: [ | ||
{ | ||
|
@@ -511,7 +527,21 @@ | |
const compact = canvasEl.querySelector( | ||
`#${containerId} [data-testid=popup-layout-scroll-region]`, | ||
); | ||
|
||
if (!compact) { | ||
// eslint-disable-next-line | ||
console.error(`#${containerId} [data-testid=popup-layout-scroll-region] not found`); | ||
return; | ||
} | ||
|
||
const label = canvasEl.querySelector(`#${containerId} .example-label`); | ||
|
||
if (!label) { | ||
// eslint-disable-next-line | ||
console.error(`#${containerId} .example-label not found`); | ||
return; | ||
} | ||
|
||
Comment on lines
+530
to
+544
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the goal of this change? |
||
const percentVisible = | ||
100 - | ||
Math.round((100 * (compact.scrollHeight - compact.clientHeight)) / compact.scrollHeight); | ||
|
@@ -526,9 +556,9 @@ | |
render: (args) => ({ | ||
props: args, | ||
template: /* HTML */ ` | ||
<div class="tw-h-[640px] tw-w-[900px] tw-border tw-border-solid tw-border-secondary-300"> | ||
<extension-popped-container> | ||
<mock-vault-page-popped></mock-vault-page-popped> | ||
</div> | ||
</extension-popped-container> | ||
`, | ||
}), | ||
}; | ||
|
@@ -576,10 +606,9 @@ | |
template: /* HTML */ ` | ||
<extension-container> | ||
<popup-page> | ||
<popup-header slot="header" background="alt" | ||
><span class="tw-italic tw-text-main">๐ค Custom Content</span></popup-header | ||
> | ||
|
||
<popup-header slot="header" background="alt"> | ||
<span class="tw-italic tw-text-main">๐ค Custom Content</span> | ||
</popup-header> | ||
<vault-placeholder></vault-placeholder> | ||
</popup-page> | ||
</extension-container> | ||
|
@@ -624,3 +653,61 @@ | |
`, | ||
}), | ||
}; | ||
|
||
export const WithVirtualScrollChild: Story = { | ||
render: (args) => ({ | ||
props: { ...args, data: Array.from(Array(20).keys()) }, | ||
template: /* HTML */ ` | ||
<extension-popped-container> | ||
<popup-page disablePadding> | ||
<popup-header slot="header" pageTitle="Test"> </popup-header> | ||
<mock-search slot="above-scroll-area"></mock-search> | ||
<div | ||
cdkVirtualScrollingElement | ||
class="tw-h-full tw-p-3 bit-compact:tw-p-2 tw-styled-scrollbar" | ||
> | ||
<div class="tw-max-w-screen-sm tw-mx-auto"> | ||
<bit-section> | ||
<bit-item-group aria-label="Mock Vault Items"> | ||
<cdk-virtual-scroll-viewport itemSize="55"> | ||
<bit-item *cdkVirtualFor="let item of data; index as i"> | ||
<button type="button" bit-item-content> | ||
<i | ||
slot="start" | ||
class="bwi bwi-globe tw-text-3xl tw-text-muted" | ||
aria-hidden="true" | ||
></i> | ||
{{ i }} of {{ data.length - 1 }} | ||
<span slot="secondary">Bar</span> | ||
</button> | ||
|
||
<ng-container slot="end"> | ||
<bit-item-action> | ||
<button type="button" bitBadge variant="primary">Fill</button> | ||
</bit-item-action> | ||
<bit-item-action> | ||
<button | ||
type="button" | ||
bitIconButton="bwi-clone" | ||
aria-label="Copy item" | ||
></button> | ||
</bit-item-action> | ||
<bit-item-action> | ||
<button | ||
type="button" | ||
bitIconButton="bwi-ellipsis-v" | ||
aria-label="More options" | ||
></button> | ||
</bit-item-action> | ||
</ng-container> | ||
</bit-item> | ||
</cdk-virtual-scroll-viewport> | ||
</bit-item-group> | ||
</bit-section> | ||
</div> | ||
</div> | ||
</popup-page> | ||
</extension-popped-container> | ||
`, | ||
}), | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,28 @@ | |
<main class="tw-flex-1 tw-overflow-hidden tw-flex tw-flex-col tw-relative tw-bg-background-alt"> | ||
<ng-content select="[slot=full-width-notice]"></ng-content> | ||
<div | ||
#nonScrollable | ||
class="tw-transition-colors tw-duration-200 tw-border-0 tw-border-b tw-border-solid tw-p-3 bit-compact:tw-p-2" | ||
[ngClass]="{ | ||
'tw-invisible !tw-p-0': loading || nonScrollable.childElementCount === 0, | ||
'tw-invisible !tw-p-0 !tw-border-none': loading || nonScrollable.childElementCount === 0, | ||
'tw-border-secondary-300': scrolled(), | ||
'tw-border-transparent': !scrolled(), | ||
}" | ||
> | ||
<ng-content select="[slot=above-scroll-area]"></ng-content> | ||
<div class="tw-max-w-screen-sm tw-mx-auto tw-w-full" #nonScrollable> | ||
<ng-content select="[slot=above-scroll-area]"></ng-content> | ||
</div> | ||
</div> | ||
<div | ||
class="tw-max-w-screen-sm tw-mx-auto tw-overflow-y-auto tw-flex tw-flex-col tw-size-full tw-styled-scrollbar" | ||
class="tw-mx-auto tw-overflow-y-auto tw-flex tw-flex-col tw-size-full tw-styled-scrollbar" | ||
data-testid="popup-layout-scroll-region" | ||
(scroll)="handleScroll($event)" | ||
[ngClass]="{ 'tw-invisible': loading }" | ||
[ngClass]="{ | ||
'tw-invisible': loading, | ||
'tw-p-3 bit-compact:tw-p-2': !disablePadding, | ||
}" | ||
> | ||
<div | ||
class="tw-max-w-screen-sm tw-mx-auto tw-flex-1 tw-flex tw-flex-col tw-w-full" | ||
[ngClass]="{ 'tw-p-3 bit-compact:tw-p-2': !disablePadding }" | ||
class="has-[[cdkvirtualscrollingelement]]:tw-max-w-full tw-max-w-screen-sm tw-mx-auto tw-flex-1 tw-flex tw-flex-col tw-w-full" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
> | ||
<ng-content></ng-content> | ||
</div> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does Vault need their own |
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.
Generally, this seems like a non-intentional limitation of the current design of the component. Thoughts?