Skip to content

docs: migrate docs app to M3 #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@angular/core": "~17.2.0",
"@angular/forms": "~17.2.0",
"@angular/material": "~17.2.0",
"@angular/material-experimental": "~17.2.0",
"@angular/platform-browser": "~17.2.0",
"@angular/platform-browser-dynamic": "~17.2.0",
"@angular/router": "~17.2.0",
Expand Down
8 changes: 7 additions & 1 deletion projects/angular-intl-demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
alt="GitHub logo"
class="logo"
matButtonIcon
src="assets/github-mark-white.png"
[ngSrc]="
isDarkTheme()
? 'assets/github-mark-white.png'
: 'assets/github-mark.png'
"
height="24"
width="24"
/>
GitHub
</a>
Expand Down
22 changes: 19 additions & 3 deletions projects/angular-intl-demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { NgOptimizedImage } from '@angular/common';
import { Component, signal } from '@angular/core';
import { MatAnchor, MatButton } from '@angular/material/button';
import { MatToolbar } from '@angular/material/toolbar';
import { RouterLink, RouterOutlet } from '@angular/router';
Expand All @@ -8,6 +9,21 @@ import { RouterLink, RouterOutlet } from '@angular/router';
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: true,
imports: [RouterLink, RouterOutlet, MatToolbar, MatButton, MatAnchor],
imports: [
RouterLink,
RouterOutlet,
MatToolbar,
MatButton,
MatAnchor,
NgOptimizedImage,
],
})
export class AppComponent {}
export class AppComponent {
darkModeQuery = window.matchMedia('(prefers-color-scheme: dark)');
isDarkTheme = signal(this.darkModeQuery.matches);
constructor() {
this.darkModeQuery.addEventListener('change', (event) => {
this.isDarkTheme.set(event.matches);
});
}
}
10 changes: 5 additions & 5 deletions projects/angular-intl-demo/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { provideHttpClient } from '@angular/common/http';
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
import { ApplicationConfig } from '@angular/core';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';
import { MarkdownModule } from 'ngx-markdown';
import { provideRouter, withHashLocation } from '@angular/router';
import { provideMarkdown } from 'ngx-markdown';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(MarkdownModule.forRoot()),
provideMarkdown(),
{
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
useValue: {
Expand All @@ -17,6 +17,6 @@ export const appConfig: ApplicationConfig = {
},
provideAnimations(),
provideHttpClient(),
provideRouter(routes),
provideRouter(routes, withHashLocation()),
],
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 23 additions & 23 deletions projects/angular-intl-demo/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
@use "@angular/material" as mat;
@use "@angular/material-experimental" as matx;

@include mat.core();

$light-theme: mat.define-light-theme(
$light-theme: matx.define-theme(
(
color: (
primary: mat.define-palette(mat.$deep-purple-palette),
accent: mat.define-palette(mat.$deep-orange-palette),
primary: matx.$m3-violet-palette,
),
typography: mat.define-typography-config(),
density: 0,
)
);

$dark-theme: mat.define-dark-theme(
$dark-theme: matx.define-theme(
(
color: (
primary: mat.define-palette(mat.$purple-palette),
accent: mat.define-palette(mat.$deep-orange-palette),
theme-type: dark,
primary: matx.$m3-magenta-palette,
),
)
);

@include mat.core-theme($light-theme);
@include mat.button-theme($light-theme);
@include mat.toolbar-theme($light-theme);
@include mat.tabs-theme($light-theme);
@include mat.select-theme($light-theme);
@include mat.input-theme($light-theme);
@include mat.form-field-theme($light-theme);
html {
@include mat.core-theme($light-theme);
@include mat.button-theme($light-theme);
@include mat.toolbar-theme($light-theme);
@include mat.tabs-theme($light-theme);
@include mat.select-theme($light-theme);
@include mat.input-theme($light-theme);
@include mat.form-field-theme($light-theme);

@media (prefers-color-scheme: dark) {
@include mat.core-color($dark-theme);
@include mat.button-color($dark-theme);
@include mat.toolbar-color($dark-theme);
@include mat.tabs-color($dark-theme);
@include mat.select-color($dark-theme);
@include mat.input-color($dark-theme);
@include mat.form-field-color($dark-theme);
@media (prefers-color-scheme: dark) {
@include mat.core-color($dark-theme);
@include mat.button-color($dark-theme);
@include mat.toolbar-color($dark-theme);
@include mat.tabs-color($dark-theme);
@include mat.select-color($dark-theme);
@include mat.input-color($dark-theme);
@include mat.form-field-color($dark-theme);
}
}

html,
Expand Down