Skip to content

Commit

Permalink
feat(sidenav): first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Badisi committed Jun 26, 2024
1 parent 93b37ec commit 46f69ec
Show file tree
Hide file tree
Showing 19 changed files with 409 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- message-box
- numeric-stepper
- overlay
- sidenav
- snackbar
- splitter
- status
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci_test_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
needs: ci_test_core
uses: ./.github/workflows/ci_test_overlay.yml

ci_test_sidenav:
needs: ci_test_core
uses: ./.github/workflows/ci_test_sidenav.yml

ci_test_snackbar:
needs: ci_test_core
uses: ./.github/workflows/ci_test_snackbar.yml
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/ci_test_sidenav.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test sidenav

on:
workflow_dispatch:
workflow_call:
push:
branches:
- '**'
tags-ignore:
- '**'
paths:
- '.github/workflows/ci_test_sidenav.yml'
- 'projects/sidenav/**'

concurrency:
group: ci-test-sidenav-group-${{ github.ref }}
cancel-in-progress: true

jobs:
ci_test_sidenav:
if: "${{ !contains(github.event.head_commit.message, 'chore(release): publish') }}"
uses: dsi-hug/action/.github/workflows/action.yml@v1
with:
working-directory: projects/sidenav
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'
node-versions: '[18, 20]'
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Package | Version | Downloads | Tests
[@hug/ngx-status](/projects/status) | [![npm version][npm-logo-status]][npm-status] | [![npm downloads][npm-dl-logo-status]][npm-dl-status] | [![build status][tests-logo-status]][tests-status]
[@hug/ngx-time-picker](/projects/time-picker) | [![npm version][npm-logo-time-picker]][npm-time-picker] | [![npm downloads][npm-dl-logo-time-picker]][npm-dl-time-picker] | [![build status][tests-logo-time-picker]][tests-time-picker]
[@hug/ngx-tooltip](/projects/tooltip) | [![npm version][npm-logo-tooltip]][npm-tooltip] | [![npm downloads][npm-dl-logo-tooltip]][npm-dl-tooltip] | [![build status][tests-logo-tooltip]][tests-tooltip]
[@hug/ngx-sidenav](/projects/sidenav) | [![npm version][npm-logo-sidenav]][npm-sidenav] | [![npm downloads][npm-dl-logo-sidenav]][npm-dl-sidenav] | [![build status][tests-logo-sidenav]][tests-sidenav]

</div>

Expand Down Expand Up @@ -143,3 +144,10 @@ Copyright (C) 2024 [HUG - Hôpitaux Universitaires Genève][dsi-hug]
[npm-dl-logo-tooltip]: https://img.shields.io/npm/dw/@hug/ngx-tooltip.svg?color=7986CB&logo=npm&label=npm
[tests-tooltip]: https://github.com/dsi-hug/ngx-components/actions/workflows/ci_test_tooltip.yml
[tests-logo-tooltip]: https://github.com/dsi-hug/ngx-components/actions/workflows/ci_test_tooltip.yml/badge.svg

[npm-sidenav]: https://www.npmjs.com/package/@hug/ngx-sidenav
[npm-logo-sidenav]: https://img.shields.io/npm/v/@hug/ngx-sidenav.svg?color=blue&logo=npm
[npm-dl-sidenav]: https://npmcharts.com/compare/@hug/ngx-sidenav?minimal=true
[npm-dl-logo-sidenav]: https://img.shields.io/npm/dw/@hug/ngx-sidenav.svg?color=7986CB&logo=npm&label=npm
[tests-sidenav]: https://github.com/dsi-hug/ngx-components/actions/workflows/ci_test_sidenav.yml
[tests-logo-sidenav]: https://github.com/dsi-hug/ngx-components/actions/workflows/ci_test_sidenav.yml/badge.svg
31 changes: 31 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,37 @@
}
}
}
},
"sidenav": {
"projectType": "library",
"root": "projects/sidenav",
"sourceRoot": "projects/sidenav/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/sidenav/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/sidenav/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/sidenav/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/sidenav/src/test.ts",
"tsConfig": "projects/sidenav/tsconfig.spec.json",
"karmaConfig": "projects/sidenav/karma.conf.js"
}
}
}
}
}
}
26 changes: 20 additions & 6 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 @@ -14,6 +14,7 @@
"projects/message-box",
"projects/numeric-stepper",
"projects/overlay",
"projects/sidenav",
"projects/snackbar",
"projects/splitter",
"projects/status",
Expand Down
6 changes: 6 additions & 0 deletions projects/sidenav/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@hug/sidenav
=======

The sources for this package are in the main [DSI-HUG/ngx-components](https://github.com/dsi-hug/ngx-components) repo. Please file issues and pull requests against that repo.

License: GPL-3.0-only
45 changes: 45 additions & 0 deletions projects/sidenav/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = config => {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/sidenav'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
failOnEmptyTestSuite: false,
restartOnFileChange: true
});
};
15 changes: 15 additions & 0 deletions projects/sidenav/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/sidenav",
"assets": [
"CHANGELOG.md",
{
"input": "src/",
"glob": "_sidenav-theme.scss",
"output": "."
}
],
"lib": {
"entryFile": "src/index.ts"
}
}
44 changes: 44 additions & 0 deletions projects/sidenav/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@hug/ngx-sidenav",
"version": "1.0.0",
"description": "HUG Angular - sidenav component",
"homepage": "https://github.com/dsi-hug/ngx-components",
"license": "GPL-3.0-only",
"author": "HUG - Hôpitaux Universitaires Genève",
"contributors": [
"badisi (https://github.com/badisi)",
"vapkse (https://github.com/vapkse)"
],
"repository": {
"type": "git",
"url": "git+https://github.com/dsi-hug/ngx-components.git"
},
"keywords": [
"angular",
"material",
"material design",
"components"
],
"sideEffects": false,
"scripts": {
"lint": "eslint . --fix",
"test": "ng test sidenav",
"test:ci": "ng test sidenav --watch=false --browsers=ChromeHeadless",
"build:ng": "ng build sidenav -c=production",
"build": "nx build:ng @hug/ngx-sidenav --verbose",
"release": "nx release -p=@hug/ngx-sidenav --yes --verbose",
"release:dry-run": "nx release -p=@hug/ngx-sidenav --verbose --dry-run"
},
"peerDependencies": {
"@angular/common": ">= 14",
"@angular/core": ">= 14",
"rxjs": ">= 7.0.0",
"@hug/ngx-core": "1.1.5"
},
"dependencies": {
"tslib": "^2.6.3"
},
"publishConfig": {
"access": "public"
}
}
56 changes: 56 additions & 0 deletions projects/sidenav/src/_sidenav-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@use '@angular/material' as mat;

@mixin sidenav-theme($theme) {
$primary: map-get($theme, primary);
$background: map-get($theme, background);
$foreground: map-get($theme, foreground);

.mat-drawer-container {
&.sidenav-light {
.mat-sidenav {
.header {
background: mat.get-color-from-palette($primary);

.header-menu-btn [fontIcon] {
color: mat.get-color-from-palette($primary, default-contrast);
}
}
}
}

.mat-sidenav {
.header {
border-bottom: 1px solid mat.get-color-from-palette($foreground, divider);
background: mat.get-color-from-palette($background, background);
}

.sidenav-menu {
border-right: 1px solid mat.get-color-from-palette($foreground, divider);

.mat-list-item {
&.active {

.mat-list-icon,
.mat-list-text {
color: mat.get-color-from-palette($primary) !important;
}

.mat-icon {
font-variation-settings: "FILL" 1;
}
}

.mat-list-item-content {
.mat-list-icon {
color: mat.get-color-from-palette($foreground, icons)
}

.mat-list-text {
color: mat.get-color-from-palette($foreground, text)
}
}
}
}
}
}
}
1 change: 1 addition & 0 deletions projects/sidenav/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './sidenav.service';
Loading

0 comments on commit 46f69ec

Please sign in to comment.