Skip to content

Commit

Permalink
feat(stack): Adds new component to arrange content and actions. #6743 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed May 15, 2023
1 parent 70f6b7b commit 7b0b567
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/components/stack/stack.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import { hidden, renders, slots } from "../../tests/commonTests";
import { html } from "../../../support/formatting";
import { hidden, renders, slots, defaults, accessible } from "../../tests/commonTests";
import { SLOTS } from "./resources";

describe("calcite-stack", () => {
it("has defaults", async () =>
defaults("calcite-stack", [
{
propertyName: "disabled",
defaultValue: false
}
]));

describe("renders", () => {
renders("calcite-stack", { display: "flex" });
});

describe("accessible when disabled", () => {
accessible(html`<calcite-stack disabled>
<calcite-action appearance="transparent" text="banana" icon="banana" slot="actions-start"></calcite-action>
Hello World
<calcite-avatar slot="content-end" thumbnail="http://placekitten.com/105/105" scale="s"> </calcite-avatar>
<calcite-chip slot="content-start" value="chip" scale="s" appearance="outline">My great chip</calcite-chip>
<calcite-action appearance="transparent" text="Close" icon="x" slot="actions-end"></calcite-action>
</calcite-stack>`);
});

it("honors hidden attribute", async () => hidden("calcite-stack"));

it("has slots", () => slots("calcite-stack", SLOTS));
Expand Down
8 changes: 8 additions & 0 deletions src/components/stack/stack.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export const simple = (): string => simpleHTML;
export const simpleDarkMode_TestOnly = (): string => simpleHTML;
simpleDarkMode_TestOnly.parameters = { modes: modesDarkDefault };

export const disabled_TestOnly = (): string => html`<calcite-stack disabled>
<calcite-action appearance="transparent" text="banana" icon="banana" slot="actions-start"></calcite-action>
Hello World
<calcite-avatar slot="content-end" thumbnail="http://placekitten.com/105/105" scale="s"> </calcite-avatar>
<calcite-chip slot="content-start" value="chip" scale="s" appearance="outline">My great chip</calcite-chip>
<calcite-action appearance="transparent" text="Close" icon="x" slot="actions-end"></calcite-action>
</calcite-stack>`;

export const panelFooter_TestOnly = (): string => html`<calcite-panel>
<div slot="header-content">My Panel</div>
<p>My content</p>
Expand Down
9 changes: 9 additions & 0 deletions src/components/stack/usage/Disabled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```html
<calcite-stack disabled>
<calcite-action appearance="transparent" text="banana" icon="banana" slot="actions-start"></calcite-action>
Hello World
<calcite-avatar slot="content-end" thumbnail="http://placekitten.com/105/105" scale="s"> </calcite-avatar>
<calcite-chip slot="content-start" value="chip" scale="s" appearance="outline">My great chip</calcite-chip>
<calcite-action appearance="transparent" text="Close" icon="x" slot="actions-end"></calcite-action>
</calcite-stack>
```

0 comments on commit 7b0b567

Please sign in to comment.