-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: material symbols scss mixins + ts const (#45)
* refactor: material symbols scss mixins + ts const and some readonly here and there * refactor: strip units if using px size
- Loading branch information
Showing
18 changed files
with
124 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/app/about/contact-traditional-icons/contact-traditional-icons.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Keep in sync with Material Symbols Sass | ||
export const MATERIAL_SYMBOLS_CLASS = 'material-symbols-outlined' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { Component } from '@angular/core' | ||
import { DarkTheme, LightTheme } from '../material-symbols' | ||
import { ColorSchemeService } from './color-scheme.service' | ||
import { MATERIAL_SYMBOLS_CLASS } from '../common/material-symbols' | ||
|
||
@Component({ | ||
selector: 'app-header', | ||
templateUrl: './header.component.html', | ||
styleUrls: ['./header.component.scss'], | ||
}) | ||
export class HeaderComponent { | ||
protected MaterialSymbol = { | ||
protected readonly MATERIAL_SYMBOLS_CLASS = MATERIAL_SYMBOLS_CLASS | ||
protected readonly MaterialSymbol = { | ||
DarkTheme, | ||
LightTheme, | ||
} | ||
|
||
constructor(protected colorSchemeService: ColorSchemeService) {} | ||
constructor(protected readonly colorSchemeService: ColorSchemeService) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import { Component } from '@angular/core' | ||
import { Warning } from '../material-symbols' | ||
import { MATERIAL_SYMBOLS_CLASS } from '../common/material-symbols' | ||
|
||
@Component({ | ||
selector: 'app-no-script', | ||
templateUrl: './no-script.component.html', | ||
styleUrls: ['./no-script.component.scss'], | ||
}) | ||
export class NoScriptComponent { | ||
protected MaterialSymbol = { | ||
protected readonly MATERIAL_SYMBOLS_CLASS = MATERIAL_SYMBOLS_CLASS | ||
protected readonly MaterialSymbol = { | ||
Warning, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
@use 'sass:math'; | ||
@use 'helpers/units'; | ||
|
||
@mixin font { | ||
@font-face { | ||
font-family: 'Material Symbols Outlined'; | ||
font-style: normal; | ||
font-weight: 100 700; | ||
font-display: block; | ||
src: | ||
url('../../assets/material-symbols-outlined-subset.woff2') format('woff2'), | ||
url('../../assets/material-symbols-outlined-subset.woff') format('woff'), | ||
url('../../assets/material-symbols-outlined-subset.ttf') | ||
format('truetype'); | ||
} | ||
|
||
@include class { | ||
//noinspection CssNoGenericFontName | ||
font-family: 'Material Symbols Outlined'; | ||
font-weight: normal; | ||
font-style: normal; | ||
font-size: 24px; | ||
line-height: 1; | ||
letter-spacing: normal; | ||
text-transform: none; | ||
display: inline-block; | ||
white-space: nowrap; | ||
word-wrap: normal; | ||
direction: ltr; | ||
-webkit-font-feature-settings: 'liga'; | ||
-webkit-font-smoothing: antialiased; | ||
} | ||
|
||
@include class { | ||
@include variation-settings; | ||
} | ||
} | ||
|
||
@mixin class { | ||
.material-symbols-outlined { | ||
@content; | ||
} | ||
} | ||
|
||
@mixin variation-settings($fill: false, $weight: 400, $grade: 0, $size: 24) { | ||
$sizeUnit: math.unit($size); | ||
@if $sizeUnit == 'px' { | ||
$size: units.strip($size); | ||
} @else if $sizeUnit != '' { | ||
@error "Size cannot have units other than 'px' (#{$size})"; | ||
} | ||
|
||
font-variation-settings: | ||
'FILL' if($fill, 1, 0), | ||
'wght' $weight, | ||
'GRAD' $grade, | ||
'opsz' $size; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { By } from '@angular/platform-browser' | ||
import { MATERIAL_SYMBOLS_CLASS } from '../../app/common/material-symbols' | ||
|
||
const MATERIAL_SYMBOLS_CLASS = 'material-symbols-outlined' | ||
export const MATERIAL_SYMBOLS_SELECTOR = By.css(`.${MATERIAL_SYMBOLS_CLASS}`) |