-
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.
feat: add theme and angular material 😍 (#41)
<!-- Hey there! 👋 Thank you for contributing to our awesome project! 🎉 Before you submit your pull request, please make sure to read our guidelines below. 😄 --> ## Description 📝 Created shared-styles lib to contain theme for any applications in the mono-repo.
- Loading branch information
1 parent
c3db8da
commit d122c74
Showing
23 changed files
with
1,589 additions
and
236 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"{apps,libs}/**/*.{ts,js,html,json,scss,css,md}": ["nx affected:lint --uncommitted --fix true"], | ||
"*": ["nx format:write --base=main --head=HEAD"] | ||
"{apps,libs}/**/*.{ts,js,html,json,scss,css,md}": [ | ||
"nx affected:lint --uncommitted --fix true", | ||
"nx format:write --uncommitted" | ||
] | ||
} |
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,22 @@ | ||
<h1>Welcome to Helderberg Pirates</h1> | ||
<mat-toolbar color="primary"> | ||
<mat-toolbar-row> | ||
<span>Helderberg Pirates</span> | ||
<mat-icon>home</mat-icon> | ||
</mat-toolbar-row> | ||
</mat-toolbar> | ||
|
||
<div class="container"> | ||
<img src="/assets/images/baseball-sticker.svg" alt="baseball sticker" class="img-fluid" /> | ||
<mat-card class="example-card"> | ||
<mat-card-header> | ||
<div mat-card-avatar class="example-header-image"></div> | ||
<mat-card-title>Making a website!</mat-card-title> | ||
<mat-card-subtitle>We're making a website</mat-card-subtitle> | ||
</mat-card-header> | ||
<img mat-card-image src="/assets/images/baseball-sticker.svg" alt="Fun baseball sticker" /> | ||
<mat-card-content> | ||
<p> | ||
We're making a website for the Helderberg Pirates baseball team. We will hopefully have it up and running soon. | ||
</p> | ||
</mat-card-content> | ||
</mat-card> | ||
</div> |
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,8 +1,9 @@ | ||
.container { | ||
display: flex; | ||
justify-content: center; | ||
padding: 15px; | ||
|
||
img { | ||
max-height: 100vh; | ||
max-height: 80vh; | ||
} | ||
} |
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 +0,0 @@ | ||
/* You can add global styles to this file, and also import other style files */ | ||
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,33 @@ | ||
{ | ||
"extends": ["../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], | ||
"rules": { | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
"type": "attribute", | ||
"prefix": "helderbergPiratesBaseball", | ||
"style": "camelCase" | ||
} | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
"type": "element", | ||
"prefix": "helderberg-pirates-baseball", | ||
"style": "kebab-case" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.html"], | ||
"extends": ["plugin:@nx/angular-template"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,7 @@ | ||
# shared-styles | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test shared-styles` to execute the unit tests. |
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,22 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'shared-styles', | ||
preset: '../../../jest.preset.js', | ||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], | ||
coverageDirectory: '../../../coverage/libs/shared/styles', | ||
transform: { | ||
'^.+\\.(ts|mjs|js|html)$': [ | ||
'jest-preset-angular', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
stringifyContentPathRegex: '\\.(html|svg)$', | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], | ||
snapshotSerializers: [ | ||
'jest-preset-angular/build/serializers/no-ng-attributes', | ||
'jest-preset-angular/build/serializers/ng-snapshot', | ||
'jest-preset-angular/build/serializers/html-comment', | ||
], | ||
}; |
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,31 @@ | ||
{ | ||
"name": "shared-styles", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/shared/styles/src", | ||
"prefix": "helderberg-pirates-baseball", | ||
"tags": [], | ||
"projectType": "library", | ||
"targets": { | ||
"test": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], | ||
"options": { | ||
"jestConfig": "libs/shared/styles/jest.config.ts", | ||
"passWithNoTests": true | ||
}, | ||
"configurations": { | ||
"ci": { | ||
"ci": true, | ||
"codeCoverage": true | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["libs/shared/styles/**/*.ts", "libs/shared/styles/**/*.html"] | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
export * from './lib/shared-styles.module'; |
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,7 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
|
||
@NgModule({ | ||
imports: [CommonModule], | ||
}) | ||
export class SharedStylesModule {} |
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,52 @@ | ||
/* You can add global styles to this file, and also import other style files */ | ||
@use '@angular/material' as mat; | ||
|
||
@include mat.core(); | ||
|
||
$primary-palette: mat.define-palette(mat.$indigo-palette); | ||
$accent-palette: mat.define-palette(mat.$grey-palette); | ||
|
||
// Define a dark theme | ||
$dark-theme: mat.define-dark-theme( | ||
( | ||
color: ( | ||
primary: $primary-palette, | ||
accent: $accent-palette, | ||
), | ||
// Only include `typography` and `density` in the default dark theme. | ||
typography: mat.define-typography-config(), | ||
density: 0, | ||
) | ||
); | ||
|
||
// Define a light theme | ||
$light-theme: mat.define-light-theme( | ||
( | ||
color: ( | ||
primary: $primary-palette, | ||
accent: $accent-palette, | ||
), | ||
) | ||
); | ||
|
||
// Apply the dark theme by default | ||
@include mat.core-theme($dark-theme); | ||
@include mat.all-component-themes($dark-theme); | ||
|
||
// Apply the light theme only when the user prefers light themes. | ||
@media (prefers-color-scheme: light) { | ||
// Use the `-color` mixins to only apply color styles without reapplying the same | ||
// typography and density styles. | ||
@include mat.core-color($light-theme); | ||
@include mat.button-color($light-theme); | ||
@include mat.toolbar-color($light-theme); | ||
} | ||
|
||
html, | ||
body { | ||
height: 100%; | ||
} | ||
body { | ||
margin: 0; | ||
font-family: Roboto, 'Helvetica Neue', sans-serif; | ||
} |
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,8 @@ | ||
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment | ||
globalThis.ngJest = { | ||
testEnvironmentOptions: { | ||
errorOnUnknownElements: true, | ||
errorOnUnknownProperties: true, | ||
}, | ||
}; | ||
import 'jest-preset-angular/setup-jest'; |
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,29 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2022", | ||
"useDefineForClassFields": false, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.lib.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
], | ||
"extends": "../../../tsconfig.base.json", | ||
"angularCompilerOptions": { | ||
"enableI18nLegacyMessageIdFormat": false, | ||
"strictInjectionParameters": true, | ||
"strictInputAccessModifiers": true, | ||
"strictTemplates": true | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/out-tsc", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"inlineSources": true, | ||
"types": [] | ||
}, | ||
"exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], | ||
"include": ["src/**/*.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/out-tsc", | ||
"module": "commonjs", | ||
"target": "es2016", | ||
"types": ["jest", "node"] | ||
}, | ||
"files": ["src/test-setup.ts"], | ||
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.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
Oops, something went wrong.