Skip to content

feat(flow-item): Add action bar slot #6887

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 1 commit into from
Apr 28, 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
14 changes: 14 additions & 0 deletions src/components/flow-item/flow-item.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,17 @@ export const noDoubleScrollbars_TestOnly = (): string => html`
</calcite-flow>
</div>
`;

export const withActionBar_TestOnly = (): string => html`<div style="width: 300px;">
<calcite-flow-item height-scale="s">
<calcite-action-bar slot="action-bar">
<calcite-action-group>
<calcite-action text="Add" icon="plus"> </calcite-action>
<calcite-action text="Save" icon="save"> </calcite-action>
<calcite-action text="Layers" icon="layers"> </calcite-action>
</calcite-action-group>
</calcite-action-bar>
<div slot="header-content">Header!</div>
<p>Slotted content!</p>
</calcite-flow-item>
</div>`;
2 changes: 2 additions & 0 deletions src/components/flow-item/flow-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { CSS, ICONS, SLOTS } from "./resources";

/**
* @slot - A slot for adding custom content.
* @slot action-bar - A slot for adding a `calcite-action-bar` to the component.
* @slot header-actions-start - A slot for adding `calcite-action`s or content to the start side of the component's header.
* @slot header-actions-end - A slot for adding `calcite-action`s or content to the end side of the component's header.
* @slot header-content - A slot for adding custom content to the component's header.
Expand Down Expand Up @@ -323,6 +324,7 @@ export class FlowItem
ref={this.setContainerRef}
>
{this.renderBackButton()}
<slot name={SLOTS.actionBar} slot={PANEL_SLOTS.actionBar} />
<slot name={SLOTS.headerActionsStart} slot={PANEL_SLOTS.headerActionsStart} />
<slot name={SLOTS.headerActionsEnd} slot={PANEL_SLOTS.headerActionsEnd} />
<slot name={SLOTS.headerContent} slot={PANEL_SLOTS.headerContent} />
Expand Down
1 change: 1 addition & 0 deletions src/components/flow-item/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const ICONS = {
};

export const SLOTS = {
actionBar: "action-bar",
headerActionsStart: "header-actions-start",
headerActionsEnd: "header-actions-end",
headerMenuActions: "header-menu-actions",
Expand Down