Skip to content

fix(panel): Allow panel content to take full height. #7454

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

Merged
merged 10 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions packages/calcite-components/src/components/panel/panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@
}

.content-wrapper {
@apply overflow-auto h-full;
}

.content-container {
@apply bg-background
flex
@apply flex
flex-auto
flex-col
flex-nowrap
items-stretch;
items-stretch
bg-background
overflow-auto
h-full;
}

.footer {
Expand Down
39 changes: 39 additions & 0 deletions packages/calcite-components/src/components/panel/panel.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,42 @@ export const footerAndActionBarWithoutContent_TestOnly = (): string => html`<cal
</calcite-action-bar>
<p slot="footer">Footer content!</p>
</calcite-panel>`;

export const flexContent_TestOnly = (): string => html`<calcite-panel
style="height: 300px; width: 500px"
heading="My Panel"
><div
style="display: flex; flex-direction: column; height: 100%; width: 100%; background-size: 16px 16px; background-color: gray; background-image: radial-gradient(
circle,
white 1px,
transparent 1px
);"
></div
></calcite-panel>`;

export const flexContentWithFAB_TestOnly = (): string => html`<calcite-panel
style="height: 300px; width: 500px"
heading="My Panel"
><div
style="display: flex; flex-direction: column; height: 100%; width: 100%; background-size: 16px 16px; background-color: gray; background-image: radial-gradient(
circle,
white 1px,
transparent 1px
);"
></div>
<calcite-fab slot="fab"></calcite-fab
></calcite-panel>`;

export const overflowContentWithFab_TestOnly = (): string => html` <calcite-panel
style="max-height: 300px; height: 300px; width: 500px"
heading="My Panel"
><div style="min-height: 500px">My Content</div>
<calcite-fab slot="fab"></calcite-fab
></calcite-panel>`;

export const noOverflowContentWithFab_TestOnly = (): string => html` <calcite-panel
style="max-height: 300px; height: 300px; width: 500px"
heading="My Panel"
><div>My Content</div>
<calcite-fab slot="fab"></calcite-fab
></calcite-panel>`;
4 changes: 1 addition & 3 deletions packages/calcite-components/src/components/panel/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,7 @@ export class Panel
// eslint-disable-next-line react/jsx-sort-props
ref={this.setPanelScrollEl}
>
<section class={CSS.contentContainer}>
<slot onSlotchange={this.handleDefaultSlotChange} />
</section>
<slot onSlotchange={this.handleDefaultSlotChange} />
{this.renderFab()}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const CSS = {
headerActionsEnd: "header-actions--end",
headerActionsStart: "header-actions--start",
contentWrapper: "content-wrapper",
contentContainer: "content-container",
fabContainer: "fab-container",
footer: "footer",
};
Expand Down