Skip to content

Commit e80d399

Browse files
committed
refactor(navbar): colorScheme prop replaced with ThemeDirective composition
1 parent 0633062 commit e80d399

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

projects/coreui-angular/src/lib/navbar/navbar.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { BreakpointObserver } from '@angular/cdk/layout';
44

55
import { CollapseDirective } from '../collapse';
66
import { Colors } from '../coreui.types';
7+
import { ThemeDirective } from '../shared';
78

89
// todo: fix container prop issue not rendering children
910
// todo: workaround - use <c-container> component directly in template
@@ -12,18 +13,17 @@ import { Colors } from '../coreui.types';
1213
selector: 'c-navbar',
1314
templateUrl: './navbar.component.html',
1415
standalone: true,
15-
imports: [NgClass, NgTemplateOutlet]
16+
imports: [NgClass, NgTemplateOutlet],
17+
hostDirectives: [
18+
{ directive: ThemeDirective, inputs: ['colorScheme'] }
19+
]
1620
})
1721
export class NavbarComponent implements AfterContentInit {
1822
/**
1923
* Sets the color context of the component to one of CoreUI’s themed colors.
2024
* @type Colors
2125
*/
2226
@Input() color?: Colors;
23-
/**
24-
* Sets if the color of text should be colored for a light or dark dark background.
25-
*/
26-
@Input() colorScheme?: 'dark' | 'light' = 'light';
2727
/**
2828
* Defines optional container wrapping children elements.
2929
*/
@@ -52,8 +52,6 @@ export class NavbarComponent implements AfterContentInit {
5252
const expandClassSuffix: string = this.expand === true ? '' : `-${this.expand}`;
5353
return {
5454
navbar: true,
55-
'navbar-light': this.colorScheme === 'light',
56-
'navbar-dark': this.colorScheme === 'dark',
5755
[`navbar-expand${expandClassSuffix}`]: !!this.expand,
5856
[`bg-${this.color}`]: !!this.color,
5957
[`${this.placement}`]: !!this.placement

0 commit comments

Comments
 (0)