Skip to content
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

chore: Update font stack #1798

Merged
merged 1 commit into from
Sep 12, 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
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ repos:
- 'prettier@3.3.3'
- 'prettier-plugin-tailwindcss@^0.6.6'
- '@trivago/prettier-plugin-sort-imports@^4.3.0'
- 'tailwindcss@^3.4.10'
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
Expand Down Expand Up @@ -166,6 +167,7 @@ repos:
- 'eslint-plugin-unused-imports@^4.1.3'
- 'eslint-plugin-tailwindcss@^3.17.4'
- 'eslint-plugin-storybook@0.9.0--canary.156.ed236ca.0'
- 'tailwindcss@^3.4.10'
args:
[
'--config',
Expand Down
2 changes: 2 additions & 0 deletions frontend/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { Preview } from '@storybook/angular';
import { applicationConfig } from '@storybook/angular';
import { ToastrModule } from 'ngx-toastr';
import docJson from '../documentation.json';
import { IconModule } from '../src/app/icon.module';

setCompodocJson(docJson);

Expand Down Expand Up @@ -41,6 +42,7 @@ const preview: Preview = {
includeTitleDuplicates: true,
}),
RouterModule.forRoot([]),
IconModule,
),
importProvidersFrom(BrowserAnimationsModule),
{ provide: MatDialogRef, useValue: {} },
Expand Down
242 changes: 208 additions & 34 deletions frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"@angular/platform-browser": "~18.2.3",
"@angular/platform-browser-dynamic": "~18.2.3",
"@angular/router": "~18.2.3",
"@fontsource/material-symbols-outlined": "^5.0.41",
"@fontsource/roboto": "^5.0.15",
"@ngneat/until-destroy": "^10.0.0",
"@panzoom/panzoom": "^4.5.1",
"file-saver": "^2.0.5",
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/app/icon.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { NgModule } from '@angular/core';
import { MatIconRegistry } from '@angular/material/icon';

@NgModule({})
export class IconModule {
constructor(private matIconReg: MatIconRegistry) {
this.matIconReg.setDefaultFontSetClass('material-symbols-outlined');
}
}
Binary file not shown.

This file was deleted.

Binary file removed frontend/src/fonts/roboto-v30-latin-300.woff2
Binary file not shown.
2 changes: 0 additions & 2 deletions frontend/src/fonts/roboto-v30-latin-300.woff2.license

This file was deleted.

Binary file not shown.
2 changes: 0 additions & 2 deletions frontend/src/fonts/roboto-v30-latin-300italic.woff2.license

This file was deleted.

Binary file removed frontend/src/fonts/roboto-v30-latin-500.woff2
Binary file not shown.
2 changes: 0 additions & 2 deletions frontend/src/fonts/roboto-v30-latin-500.woff2.license

This file was deleted.

Binary file not shown.
2 changes: 0 additions & 2 deletions frontend/src/fonts/roboto-v30-latin-500italic.woff2.license

This file was deleted.

Binary file not shown.
2 changes: 0 additions & 2 deletions frontend/src/fonts/roboto-v30-latin-italic.woff2.license

This file was deleted.

Binary file removed frontend/src/fonts/roboto-v30-latin-regular.woff2
Binary file not shown.
2 changes: 0 additions & 2 deletions frontend/src/fonts/roboto-v30-latin-regular.woff2.license

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { AppRoutingModule } from './app/app-routing.module';
import { AppComponent } from './app/app.component';
import { AuthInterceptor } from './app/general/auth/http-interceptor/auth.interceptor';
import { ErrorHandlingInterceptor } from './app/general/error-handling/error-handling.interceptor';
import { IconModule } from './app/icon.module';
import { environment } from './environments/environment';

if (environment.production) {
Expand All @@ -38,6 +39,7 @@ bootstrapApplication(AppComponent, {
resetTimeoutOnDuplicate: true,
includeTitleDuplicates: true,
}),
IconModule,
),
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
{
Expand Down
73 changes: 9 additions & 64 deletions frontend/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,25 @@

/* You can add global styles to this file, and also import other style files */

@import "@fontsource/roboto/300.css";
@import "@fontsource/roboto/400.css";
@import "@fontsource/roboto/500.css";
@import "@fontsource/roboto/700.css";
@import "@fontsource/material-symbols-outlined/400.css";

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
@font-face {
font-display: swap;
font-family: "Roboto";
font-style: normal;
font-weight: 300;
src: url("fonts/roboto-v30-latin-300.woff2") format("woff2");
}
@font-face {
font-display: swap;
font-family: "Roboto";
font-style: italic;
font-weight: 300;
src: url("fonts/roboto-v30-latin-300italic.woff2") format("woff2");
}
@font-face {
font-display: swap;
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: url("fonts/roboto-v30-latin-regular.woff2") format("woff2");
}
@font-face {
font-display: swap;
font-family: "Roboto";
font-style: italic;
font-weight: 400;
src: url("fonts/roboto-v30-latin-italic.woff2") format("woff2");
}
@font-face {
font-display: swap;
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: url("fonts/roboto-v30-latin-500.woff2") format("woff2");
}
@font-face {
font-display: swap;
font-family: "Roboto";
font-style: italic;
font-weight: 500;
src: url("fonts/roboto-v30-latin-500italic.woff2") format("woff2");
}
@font-face {
font-display: swap;
font-family: "Material Icons";
font-style: normal;
font-weight: 400;
src: url("fonts/material-icons-v142-latin-regular.woff2") format("woff2");
}
}

html,
body {
height: 100%;
font-size: 100%;
}

/* Copied from https://developers.google.com/fonts/docs/material_icons#setup_method_2_self_hosting */
.material-icons {
font-family: "Material Icons";
/* Copied from https://fontsource.org/docs/getting-started/material-symbols */
.material-symbols-outlined {
font-family: "Material Symbols Outlined";
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
Expand All @@ -80,14 +34,6 @@ body {
word-wrap: normal;
white-space: nowrap;
direction: ltr;

/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;

/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
}

html {
Expand All @@ -97,7 +43,6 @@ html {

body {
@apply m-0;
font-family: Roboto, "Helvetica Neue", sans-serif;
}

a {
Expand Down
4 changes: 4 additions & 0 deletions frontend/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
* SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
* SPDX-License-Identifier: Apache-2.0
*/
const defaultTheme = require("tailwindcss/defaultTheme");

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,ts}"],
theme: {
extend: {
fontFamily: {
sans: ["Roboto", ...defaultTheme.fontFamily.sans],
},
colors: {
primary: "var(--primary-color)",
error: "var(--error-color)",
Expand Down
Loading