Skip to content

Commit 19b8582

Browse files
authored
Merge pull request #250 from youda97/light-inline-codesnippet
feat(code-snippet): Add inline light style
2 parents 11f3a0c + 1645126 commit 19b8582

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/code-snippet/code-snippet.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ export class CodeSnippet {
9696
@Input() display: SnippetType = SnippetType.single;
9797
@Input() translations = this.i18n.get().CODE_SNIPPET;
9898

99+
/**
100+
* Set to `"light"` to apply the light style on the code snippet.
101+
* @type {"light" | "dark"}
102+
* @memberof CodeSnippet
103+
*/
104+
@Input() theme: "light" | "dark" = "dark";
105+
99106
/**
100107
* Text displayed in the tooltip when user clicks button to copy code.
101108
*
@@ -122,6 +129,9 @@ export class CodeSnippet {
122129
@HostBinding("class.bx--snippet--inline") get snippetInlineClass() {
123130
return this.display === SnippetType.inline;
124131
}
132+
@HostBinding("class.bx--snippet--light") get snippetInlineLightClass() {
133+
return this.display === SnippetType.inline && this.theme === "light";
134+
}
125135
@HostBinding("class.bx--btn--copy") get btnCopyClass() {
126136
return this.display === SnippetType.inline;
127137
}

src/code-snippet/code-snippet.stories.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,10 @@ storiesOf("CodeSnippet", module).addDecorator(
6666
props: {
6767
inlineCode
6868
}
69+
}))
70+
.add("Inline Light", () => ({
71+
template: `Here is some <ibm-code-snippet display="inline" theme="light">{{inlineCode}}</ibm-code-snippet> for you.`,
72+
props: {
73+
inlineCode
74+
}
6975
}));

0 commit comments

Comments
 (0)