Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 0583bf7

Browse files
committed
feat(theme): Implement MDC Theme - mdc-theme-dark directive.
1 parent f7600ed commit 0583bf7

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/lib/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NgModule } from '@angular/core';
22

3+
import { ThemeModule } from './theme';
34
import { ButtonModule } from './button';
45
import { CardModule } from './card';
56
import { CheckboxModule } from './checkbox';
@@ -17,6 +18,7 @@ import { TextfieldModule } from './textfield';
1718
import { ToolbarModule } from './toolbar';
1819
import { TypographyModule } from './typography';
1920

21+
export * from './theme';
2022
export * from './button';
2123
export * from './card';
2224
export * from './checkbox';
@@ -35,15 +37,16 @@ export * from './toolbar';
3537
export * from './typography';
3638

3739
const MATERIAL_MODULES = [
40+
ThemeModule,
3841
ButtonModule,
3942
CardModule,
4043
CheckboxModule,
4144
ElevationModule,
4245
FabModule,
43-
PlatformModule,
4446
FormFieldModule,
4547
LinearProgressModule,
4648
MenuModule,
49+
PlatformModule,
4750
RadioModule,
4851
RippleModule,
4952
SnackbarModule,

src/lib/theme/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { ThemeDark } from './theme-dark.directive';
4+
5+
const THEME_DIRECTIVES = [
6+
ThemeDark
7+
];
8+
9+
@NgModule({
10+
exports: [THEME_DIRECTIVES],
11+
declarations: [THEME_DIRECTIVES],
12+
})
13+
export class ThemeModule { }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {
2+
Directive,
3+
HostBinding,
4+
} from '@angular/core';
5+
6+
@Directive({
7+
selector: '[mdc-theme-dark]'
8+
})
9+
export class ThemeDark {
10+
@HostBinding('class.mdc-theme--dark') classThemeDark: string = 'mdc-theme--dark';
11+
}

0 commit comments

Comments
 (0)