Skip to content

Commit 379c21b

Browse files
committed
feat: added default theme vars on button
1 parent e778775 commit 379c21b

File tree

7 files changed

+76
-1
lines changed

7 files changed

+76
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<button mat-flat-button class="primary">Default Primary</button>
2+
<button mat-flat-button class="secondary">Default Secondary</button>
3+
<button mat-flat-button class="accent">Default Accent</button>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@use "@angular/material" as mat;
2+
3+
@mixin button-color($color) {
4+
@if $color == "primary" {
5+
$color: var(--mat-sys-primary);
6+
} @else if $color == "secondary" {
7+
$color: var(--mat-sys-secondary);
8+
} @else if $color == "accent" {
9+
$color: var(--mat-sys-tertiary);
10+
}
11+
12+
@include mat.button-overrides(
13+
(
14+
filled-container-color: $color,
15+
)
16+
);
17+
}
18+
19+
.primary {
20+
@include button-color("primary");
21+
}
22+
23+
.secondary {
24+
@include button-color("secondary");
25+
}
26+
27+
.accent {
28+
@include button-color("accent");
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { ColorShowcaseComponent } from './color-showcase.component';
4+
5+
describe('ColorShowcaseComponent', () => {
6+
let component: ColorShowcaseComponent;
7+
let fixture: ComponentFixture<ColorShowcaseComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [ColorShowcaseComponent]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(ColorShowcaseComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component } from '@angular/core';
2+
import { MaterialModule } from '../../modules/material.module';
3+
4+
@Component({
5+
selector: 'app-color-showcase',
6+
imports: [MaterialModule],
7+
templateUrl: './color-showcase.component.html',
8+
styleUrl: './color-showcase.component.scss',
9+
})
10+
export class ColorShowcaseComponent {}

src/app/components/grid-container/grid-container.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
@case (workspace.Filter) {
88
<app-form-filter [widgetInput]="filterState()"></app-form-filter>
99
}
10+
@case (workspace.Button) {
11+
<app-color-showcase></app-color-showcase>
12+
}
1013
}
1114
}
1215
</div>

src/app/components/grid-container/grid-container.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ import { map } from 'rxjs';
55
import { FILTER_INPUT } from '../../constants/dummy-data/fund-input-dummy';
66
import { WorkspaceName } from '../../constants/workspace-name.enum';
77
import { WidgetInput } from '../../models/widget-input.model';
8+
import { ColorShowcaseComponent } from '../color-showcase/color-showcase.component';
89
import { FormFilterModule } from '../form-filter/form-filter.module';
910
import { SavedFilter } from '../form-filter/models/saved-filter.model';
1011
import { WorkspaceSelectorComponent } from '../workspace-selector/workspace-selector.component';
1112

1213
@Component({
1314
selector: 'app-grid-container',
14-
imports: [CommonModule, WorkspaceSelectorComponent, FormFilterModule],
15+
imports: [
16+
CommonModule,
17+
WorkspaceSelectorComponent,
18+
FormFilterModule,
19+
ColorShowcaseComponent,
20+
],
1521
templateUrl: './grid-container.component.html',
1622
styleUrl: './grid-container.component.scss',
1723
standalone: true,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export enum WorkspaceName {
22
Dashboard = 'dashboard',
33
Filter = 'filter',
4+
Button = 'button',
45
}

0 commit comments

Comments
 (0)