Skip to content

Commit 0fa32c6

Browse files
committed
Feat: Use SegmentedGroup for dropdown dismiss
1 parent b9383cb commit 0fa32c6

File tree

2 files changed

+51
-44
lines changed

2 files changed

+51
-44
lines changed
Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,52 @@
11
{{! @glint-nocheck }}
2-
<Hds::Dropdown
3-
@listPosition="bottom-left"
4-
@height="240px"
5-
@searchEnabled={{@searchEnabled}}
6-
@searchPlaceholder="Search {{@key}}"
7-
@onDismiss={{this.onDismiss}}
8-
{{this._setUpDropdown}}
9-
class={{this.classNames}}
10-
data-filter-key="{{@key}}"
11-
as |D|
12-
>
13-
<D.ToggleButton @text={{this.toggleButtonText}} @color="secondary" @size="small" />
14-
{{#if (eq @type "range")}}
15-
<Hds::FilterBar::Range
16-
@generic={{D.Generic}}
17-
@keyFilter={{this.internalFilters}}
18-
@onChange={{this.onRangeChange}}
19-
/>
20-
{{else}}
21-
{{yield
22-
(hash
23-
Checkbox=(component
24-
"hds/filter-bar/checkbox" checkbox=D.Checkbox keyFilter=this.internalFilters onChange=this.onSelectionChange
2+
<Hds::SegmentedGroup class={{this.classNames}} data-filter-key="{{@key}}" as |SG|>
3+
<SG.Button
4+
@text="Clear filter"
5+
@icon="x"
6+
@color="secondary"
7+
@size="small"
8+
@isIconOnly={{true}}
9+
{{on "click" this.onDismiss}}
10+
/>
11+
<SG.Dropdown
12+
@listPosition="bottom-left"
13+
@height="240px"
14+
@searchEnabled={{@searchEnabled}}
15+
@searchPlaceholder="Search {{@key}}"
16+
{{this._setUpDropdown}}
17+
as |D|
18+
>
19+
<D.ToggleButton @text={{this.toggleButtonText}} @color="secondary" @size="small" />
20+
{{#if (eq @type "range")}}
21+
<Hds::FilterBar::Range
22+
@generic={{D.Generic}}
23+
@keyFilter={{this.internalFilters}}
24+
@onChange={{this.onRangeChange}}
25+
/>
26+
{{else}}
27+
{{yield
28+
(hash
29+
Checkbox=(component
30+
"hds/filter-bar/checkbox" checkbox=D.Checkbox keyFilter=this.internalFilters onChange=this.onSelectionChange
31+
)
32+
Radio=(component
33+
"hds/filter-bar/radio" radio=D.Radio keyFilter=this.internalFilters onChange=this.onSelectionChange
34+
)
2535
)
26-
Radio=(component
27-
"hds/filter-bar/radio" radio=D.Radio keyFilter=this.internalFilters onChange=this.onSelectionChange
28-
)
29-
)
30-
}}
31-
{{/if}}
32-
{{#unless @isLiveFilter}}
33-
<D.Footer @hasDivider={{true}}>
34-
<Hds::ButtonSet>
35-
<Hds::Button
36-
@text="Apply filters"
37-
@isFullWidth={{true}}
38-
@size="small"
39-
{{on "click" (fn this.onApply D.close)}}
40-
/>
41-
<Hds::Button @text="Clear" @color="secondary" @size="small" {{on "click" (fn this.onClear D.close)}} />
42-
</Hds::ButtonSet>
43-
</D.Footer>
44-
{{/unless}}
45-
</Hds::Dropdown>
36+
}}
37+
{{/if}}
38+
{{#unless @isLiveFilter}}
39+
<D.Footer @hasDivider={{true}}>
40+
<Hds::ButtonSet>
41+
<Hds::Button
42+
@text="Apply filters"
43+
@isFullWidth={{true}}
44+
@size="small"
45+
{{on "click" (fn this.onApply D.close)}}
46+
/>
47+
<Hds::Button @text="Clear" @color="secondary" @size="small" {{on "click" (fn this.onClear D.close)}} />
48+
</Hds::ButtonSet>
49+
</D.Footer>
50+
{{/unless}}
51+
</SG.Dropdown>
52+
</Hds::SegmentedGroup>

packages/components/src/styles/components/filter-bar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}
5757

5858
// DROPDOWN
59-
.hds-filter-bar__dropdown--hidden.hds-dropdown {
59+
.hds-filter-bar__dropdown--hidden.hds-segmented-group {
6060
display: none;
6161
}
6262

0 commit comments

Comments
 (0)