Skip to content

Commit 2216998

Browse files
committed
Chore: Add FilterBar showcase page
1 parent e53ee26 commit 2216998

File tree

6 files changed

+118
-0
lines changed

6 files changed

+118
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
import type { TemplateOnlyComponent } from '@ember/component/template-only';
7+
import { pageTitle } from 'ember-page-title';
8+
9+
import ShwTextH1 from 'showcase/components/shw/text/h1';
10+
11+
import SubSectionBasic from 'showcase/components/page-components/filter-bar/sub-sections/basic';
12+
13+
const FilterBarIndex: TemplateOnlyComponent = <template>
14+
{{pageTitle "FilterBar Component"}}
15+
16+
<ShwTextH1>Filter Bar</ShwTextH1>
17+
18+
<section data-test-percy>
19+
<SubSectionBasic />
20+
</section>
21+
</template>;
22+
23+
export default FilterBarIndex;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
import Component from '@glimmer/component';
7+
8+
import ShwDivider from 'showcase/components/shw/divider';
9+
import ShwPlaceholder from 'showcase/components/shw/placeholder';
10+
import ShwTextH2 from 'showcase/components/shw/text/h2';
11+
12+
import { HdsFilterBar } from '@hashicorp/design-system-components/components';
13+
14+
export default class SubSectionBasic extends Component {
15+
private _filters = {};
16+
17+
<template>
18+
<ShwTextH2>Basic usage</ShwTextH2>
19+
20+
<HdsFilterBar @filters={{this._filters}} @hasSearch={{true}} as |F|>
21+
<F.ActionsGeneric>
22+
<ShwPlaceholder @text="generic content" @height="24" />
23+
</F.ActionsGeneric>
24+
<F.ActionsDropdown as |D|>
25+
<D.ToggleButton @text="Actions" @color="secondary" @size="small" />
26+
<D.Checkbox>Action 1</D.Checkbox>
27+
<D.Checkbox>Action 2</D.Checkbox>
28+
<D.Checkbox>Action 3</D.Checkbox>
29+
</F.ActionsDropdown>
30+
<F.Dropdown as |D|>
31+
<D.FilterGroup
32+
@key="multi-select"
33+
@text="Multi-select"
34+
@type="multi-select"
35+
@searchEnabled={{true}}
36+
as |F|
37+
>
38+
<F.Checkbox @value="1">Option 1</F.Checkbox>
39+
<F.Checkbox @value="2">Option 2</F.Checkbox>
40+
<F.Checkbox @value="3">Option 3</F.Checkbox>
41+
</D.FilterGroup>
42+
<D.FilterGroup
43+
@key="single-select"
44+
@text="Single-select"
45+
@type="single-select"
46+
@searchEnabled={{true}}
47+
as |F|
48+
>
49+
<F.Radio @value="1">Option 1</F.Radio>
50+
<F.Radio @value="2">Option 2</F.Radio>
51+
<F.Radio @value="3">Option 3</F.Radio>
52+
</D.FilterGroup>
53+
<D.FilterGroup @key="numerical" @text="Numerical" @type="numerical" />
54+
<D.FilterGroup @key="date" @text="Date" @type="date" />
55+
<D.FilterGroup @key="datetime" @text="Datetime" @type="datetime" />
56+
<D.FilterGroup @key="time" @text="Time" @type="time" />
57+
</F.Dropdown>
58+
</HdsFilterBar>
59+
60+
<ShwDivider />
61+
</template>
62+
}

showcase/app/router.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Router.map(function () {
5050
this.route('code-block');
5151
this.route('code-editor');
5252
this.route('dropdown');
53+
this.route('filter-bar');
5354
this.route('flyout');
5455
this.route('form', function (): void {
5556
this.route('frameless', function (): void {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
import Route from '@ember/routing/route';
7+
8+
import type { ModelFrom } from 'showcase/utils/model-from-route';
9+
10+
export type PageComponentsFilterBarModel =
11+
ModelFrom<PageComponentsFilterBarRoute>;
12+
13+
export default class PageComponentsFilterBarRoute extends Route {}

showcase/app/templates/index.gts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ const Index: TemplateOnlyComponent = <template>
137137
Dropdown
138138
</LinkTo>
139139
</li>
140+
<li>
141+
<LinkTo @route="page-components.filter-bar">
142+
FilterBar
143+
</LinkTo>
144+
</li>
140145
<li>
141146
<LinkTo @route="page-components.flyout">
142147
Flyout
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
import type { TemplateOnlyComponent } from '@ember/component/template-only';
7+
8+
import FilterBarIndex from 'showcase/components/page-components/filter-bar/index';
9+
10+
const PageComponentsFilterBar: TemplateOnlyComponent = <template>
11+
<FilterBarIndex />
12+
</template>;
13+
14+
export default PageComponentsFilterBar;

0 commit comments

Comments
 (0)