Skip to content

Commit

Permalink
feat: Provide a Sidebar page-layout porscheinformatik#149
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Pestel committed Nov 9, 2023
1 parent 71617c0 commit 433abc3
Show file tree
Hide file tree
Showing 68 changed files with 599 additions and 143 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.content-header {
padding-right: 0.5rem;
background-color: var(--background-color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
overflow-y: auto;
border-top: 0.05rem solid #cccccc;
padding: 1rem;
height: 1rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<ng-content></ng-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:host {
border-top: 0.05rem solid #cccccc;
min-height: 2rem;
display: flex;
flex: 0 0 auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Component } from '@angular/core';

@Component({
selector: 'mad-content-panel-container-sidebar',
templateUrl: './content-panel-container-sidebar.component.html',
styleUrls: ['./content-panel-container-sidebar.component.scss'],
})
export class ContentPanelContainerSidebarComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="content-panel-sidebar-wrapper">
<ng-content select="mad-content-panel-container-sidebar"></ng-content>
<div class="content-panel-outer-wrapper">
<ng-content select="mad-content-panel-container-content"></ng-content>
<ng-content select="mad-content-panel-container-footer"></ng-content>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
display: flex;
flex: 1 1 auto;
min-height: 0.05rem;
background-color: var(--background-color);
}

.content-panel-outer-wrapper {
display: flex;
flex: 1 1 auto;
flex-direction: column;
}
.content-panel-sidebar-wrapper {
width: 100%;
display: flex;
flex: 1 1 auto;
flex-direction: row;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ContentHeaderComponent } from './content-header/content-header.component';
import { ContentPanelContainerComponent } from './content-panel-container/content-panel-container.component';
import { ContentPanelContainerContentComponent } from './content-panel-container-content/content-panel-container-content.component';
import { ContentPanelContainerFooterComponent } from './content-panel-container-footer/content-panel-container-footer.component';
import { MainContainerComponent } from './main-container/main-container.component';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ContentPanelContainerSidebarComponent } from './content-panel-container-sidebar/content-panel-container-sidebar.component';

import { MainContainerComponent } from './main-container/main-container.component';
@NgModule({
declarations: [
ContentHeaderComponent,
ContentPanelContainerComponent,
ContentPanelContainerContentComponent,
ContentPanelContainerFooterComponent,
ContentPanelContainerSidebarComponent,
MainContainerComponent,
],
imports: [CommonModule],
Expand All @@ -20,6 +23,7 @@ import { CommonModule } from '@angular/common';
ContentPanelContainerComponent,
ContentPanelContainerContentComponent,
ContentPanelContainerFooterComponent,
ContentPanelContainerSidebarComponent,
MainContainerComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<span class="content-wrapper">
<ng-content></ng-content>
</span>
<span class="focus-overlay"></span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[mad-sidebar-item] {
padding: 9px 24px 8px;
color: var(--panel-color);
position: relative;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
font-weight: 300;

letter-spacing: 0.5px;

.focus-overlay {
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
pointer-events: none;
border-radius: inherit;
}

&.active-sidebar-item {
background-color: var(--panel-select-background);
}

&:hover {
.focus-overlay {
background-color: black;
opacity: 0.04;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
selector: '[mad-sidebar-item]',
templateUrl: 'sidebar-item.component.html',
styleUrls: ['sidebar-item.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class SidebarItemComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div [class.collapsed]="collapsed" class="sidebar-wrapper">
<div class="sidebar-header">
<button (click)="toggleCollapse()" color="basic" mat-button>
<mat-icon>{{ collapsed ? 'keyboard_double_arrow_right' : 'keyboard_double_arrow_left' }}</mat-icon>
</button>
</div>
<div class="item-list">
<ng-content></ng-content>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$color-gray: #707070;

.sidebar-wrapper {
background: var(--panel-background-color);
min-height: 100%;
display: flex;
flex-direction: column;
border-right: 1px solid var(--panel-border-color);
margin-top: 10px;

transition: width 0.1s ease-in;

&:not(.collapsed) {
min-width: 239px;
}

&.collapsed {
width: 64px;
}

.sidebar-header {
display: flex;
flex-direction: row-reverse;
border-bottom: 1px solid var(--panel-border-color);

button {
color: $color-gray;
}
}

&.collapsed {
.item-list {
display: none;
}
}

.item-list {
display: flex;
flex-direction: column;
margin-top: 16px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component } from '@angular/core';

@Component({
selector: 'mad-sidebar',
templateUrl: './sidebar.component.html',
styleUrls: ['./sidebar.component.scss'],
})
export class SidebarComponent {
collapsed = false;

toggleCollapse() {
this.collapsed = !this.collapsed;
}
}
13 changes: 13 additions & 0 deletions projects/material-addons/src/lib/layout/sidebar/sidebar.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SidebarComponent } from './sidebar.component';
import { SidebarItemComponent } from './sidebar-item/sidebar-item.component';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';

@NgModule({
declarations: [SidebarComponent, SidebarItemComponent],
exports: [SidebarComponent, SidebarItemComponent],
imports: [CommonModule, MatIconModule, MatButtonModule],
})
export class SidebarModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Action, BackAction, MainAction, ToolbarAction } from './toolbar-action.
@Component({
selector: 'mad-toolbar',
templateUrl: './toolbar.component.html',
styleUrls: ['./toolbar.component.css'],
styleUrls: ['./toolbar.component.scss'],
})
export class ToolbarComponent {
isHandset$: Observable<boolean> = this.breakpointObserver.observe([Breakpoints.Handset]).pipe(map((result) => result.matches));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { ToolbarComponent } from './toolbar.component';
import { MaterialActionButtonModule } from '../material-action-button/material-action-button.module';
import { MaterialActionButtonModule } from '../../material-action-button/material-action-button.module';
import { MatMenuModule } from '@angular/material/menu';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatTooltipModule } from '@angular/material/tooltip';
import { ButtonModule } from '../button/button.module';
import { ButtonModule } from '../../button/button.module';
import { MatBadgeModule } from '@angular/material/badge';

@NgModule({
Expand Down
4 changes: 3 additions & 1 deletion projects/material-addons/src/lib/material-addons.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { NgModule } from '@angular/core';
import { ToolbarModule } from './toolbar/toolbar.module';
import { ToolbarModule } from './layout/toolbar/toolbar.module';
import { ReadOnlyFormFieldModule } from './readonly/readonly-form-field.module';
import { MaterialActionButtonModule } from './material-action-button/material-action-button.module';
import { NumericFieldModule } from './numeric-field/numeric-field.module';
import { CardModule } from './card/card.module';
import { QuickListModule } from './quick-list/quick-list.module';
import { ButtonModule } from './button/button.module';
import { ThrottleClickModule } from './throttle-click/throttle-click.module';
import { SidebarModule } from './layout/sidebar/sidebar.module';

@NgModule({
exports: [
Expand All @@ -18,6 +19,7 @@ import { ThrottleClickModule } from './throttle-click/throttle-click.module';
CardModule,
QuickListModule,
ThrottleClickModule,
SidebarModule,
],
})
export class MaterialAddonsModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { FormBuilder } from '@angular/forms';
@Component({
selector: 'mad-quick-list-compact',
templateUrl: './quick-list-compact.component.html',
styleUrls: [],
styles: [
`
.quick-list-row {
flex-direction: row;
box-sizing: border-box;
display: flex;
}
`,
],
})
export class QuickListCompactComponent extends BaseQuickListComponent<QuickListItem> {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
width: 100%;
height: 62px;

display: flex;
flex-direction: row;
box-sizing: border-box;
display: flex;
gap: 1em;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
border-left: 1px solid lightgrey;
border-right: 1px solid lightgrey;
border-bottom: 1px solid lightgrey;
display: flex;

flex-direction: column;
box-sizing: border-box;
display: flex;
}

.step-content {
Expand Down
34 changes: 22 additions & 12 deletions projects/material-addons/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ export * from './lib/button/button.module';
export * from './lib/readonly/readonly-form-field.module';
export * from './lib/readonly/readonly-form-field-wrapper/readonly-form-field-wrapper.component';
export * from './lib/readonly/readonly-form-field/readonly-form-field.component';
export * from './lib/toolbar/toolbar.module';
export * from './lib/toolbar/toolbar.component';
export * from './lib/toolbar/toolbar.service';
export * from './lib/toolbar/toolbar-action.interface';

export * from './lib/numeric-field/numeric-field';
export * from './lib/numeric-field/numeric-field.module';
export * from './lib/numeric-field/number-format.service';
Expand All @@ -29,12 +26,25 @@ export * from './lib/stepper/stepper.component';
export * from './lib/stepper/step-header/step-header.component';
export * from './lib/stepper/mad-stepper-animation';
export * from './lib/stepper/stepper.module';
export * from './lib/content-panel/content-header/content-header.component';
export * from './lib/content-panel/content-panel-container/content-panel-container.component';
export * from './lib/content-panel/content-panel-container-content/content-panel-container-content.component';
export * from './lib/content-panel/content-panel-container-footer/content-panel-container-footer.component';
export * from './lib/content-panel/main-container/main-container.component';
export * from './lib/content-panel/content-panel.module';
export * from './lib/flowbar/flowbar.component';
export * from './lib/flowbar/flowbar.module';

export * from './lib/layout/content-panel/content-header/content-header.component';
export * from './lib//layout/content-panel/content-panel-container/content-panel-container.component';
export * from './lib//layout/content-panel/content-panel-container-content/content-panel-container-content.component';
export * from './lib//layout/content-panel/content-panel-container-footer/content-panel-container-footer.component';
export * from './lib//layout/content-panel/content-panel-container-sidebar/content-panel-container-sidebar.component';
export * from './lib//layout/content-panel/main-container/main-container.component';
export * from './lib//layout/content-panel/content-panel.module';

export * from './lib/layout/flowbar/flowbar.component';
export * from './lib/layout/flowbar/flowbar.module';

export * from './lib/layout/sidebar/sidebar.component';
export * from './lib/layout/sidebar/sidebar-item/sidebar-item.component';
export * from './lib/layout/sidebar/sidebar.module';

export * from './lib/layout/toolbar/toolbar.module';
export * from './lib/layout/toolbar/toolbar.component';
export * from './lib/layout/toolbar/toolbar.service';
export * from './lib/layout/toolbar/toolbar-action.interface';

export * from './lib/material-addons.module';
Loading

0 comments on commit 433abc3

Please sign in to comment.