Skip to content

Commit fe77085

Browse files
authored
Merge pull request #214 from panpan-lin/issue-163-light-style-dropdown
Add light style for Dropdown component
2 parents a2b61a7 + 8b87f9a commit fe77085

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/dropdown/dropdown.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import { I18n } from "./../i18n/i18n.module";
2828
@Component({
2929
selector: "ibm-dropdown",
3030
template: `
31-
<div class="bx--list-box">
31+
<div
32+
class="bx--list-box"
33+
[ngClass]="{'bx--dropdown--light': theme === 'light'}">
3234
<button
3335
type="button"
3436
#dropdownButton
@@ -82,7 +84,11 @@ export class Dropdown implements OnInit, AfterContentInit, OnDestroy {
8284
* item selection.
8385
*/
8486
@Input() type: "single" | "multi" = "single";
85-
87+
/**
88+
* `light` or `dark` dropdown theme
89+
* @memberof Dropdown
90+
*/
91+
@Input() theme: "light" | "dark" = "dark";
8692
/**
8793
* Set to `true` to disable the dropdown.
8894
*/

src/dropdown/dropdown.stories.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,29 @@ storiesOf("Dropdown", module)
4141
onClose: action("Dropdown closed")
4242
}
4343
}))
44+
.add("Light", () => ({
45+
template: `
46+
<ibm-dropdown
47+
theme="light"
48+
placeholder="Select"
49+
[disabled]="disabled"
50+
(selected)="selected($event)"
51+
(onClose)="onClose($event)">
52+
<ibm-dropdown-list [items]="items"></ibm-dropdown-list>
53+
</ibm-dropdown>
54+
`,
55+
props: {
56+
disabled: boolean("disabled", false),
57+
items: object("items", [
58+
{ content: "one" },
59+
{ content: "two" },
60+
{ content: "three" },
61+
{ content: "four" }
62+
]),
63+
selected: action("Selected fired for dropdown"),
64+
onClose: action("Dropdown closed")
65+
}
66+
}))
4467
.add("Multi-select", withNotes({ text: "Notes on multi select" })(() => ({
4568
template: `
4669
<ibm-dropdown

0 commit comments

Comments
 (0)