-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): allow multiple sidebars of various modes and sides
This reworks to use new modes: 1. side 2. side-fixed 3. over 4. under Additionally, we now better support sidebars on each side of the viewport. BREAKING CHANGE: The sidebar now holds the state of the sidebar (instead of the viewport), specifically "mode" and "open".
- Loading branch information
1 parent
a3be91f
commit dd6bc28
Showing
63 changed files
with
1,318 additions
and
385 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
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,22 +1,21 @@ | ||
<h1 daffArticleTitle>Sidebar</h1> | ||
|
||
<design-land-article-encapsulated> | ||
<daff-form-field> | ||
<select daff-native-select [(ngModel)]="mode"> | ||
<option value="push">Push (push)</option> | ||
<option value="side">Side (side)</option> | ||
<option value="over">Over (over)</option> | ||
<option value="fixed">Fixed (fixed)</option> | ||
</select> | ||
</daff-form-field> | ||
|
||
<button daff-button (click)="open = !open">{{ open ? "Close" : "Open" }}</button> | ||
|
||
<daff-sidebar-viewport [mode]="mode" [opened]="open"> | ||
<daff-sidebar> | ||
<a daff-link-set-item routerLink="accordion">Accordion</a><br> | ||
<a daff-link-set-item routerLink="article">Article</a><br> | ||
</daff-sidebar> | ||
<p>Some Content</p> | ||
</daff-sidebar-viewport> | ||
<h1>Outside Focus </h1> | ||
<input> <input> | ||
<design-land-example-viewer-container example="basic-sidebar"></design-land-example-viewer-container> | ||
</design-land-article-encapsulated> | ||
|
||
<design-land-article-encapsulated> | ||
<design-land-example-viewer-container example="sidebar-with-sticky"></design-land-example-viewer-container> | ||
</design-land-article-encapsulated> | ||
|
||
<design-land-article-encapsulated> | ||
<design-land-example-viewer-container example="two-fixed-sidebars-either-side"></design-land-example-viewer-container> | ||
</design-land-article-encapsulated> | ||
|
||
<design-land-article-encapsulated> | ||
<design-land-example-viewer-container example="fixed-and-over-sidebar"></design-land-example-viewer-container> | ||
</design-land-article-encapsulated> | ||
|
||
<design-land-article-encapsulated> | ||
<design-land-example-viewer-container example="under-sidebar"></design-land-example-viewer-container> | ||
</design-land-article-encapsulated> |
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,16 +1,8 @@ | ||
import { | ||
Component, | ||
OnInit, | ||
} from '@angular/core'; | ||
|
||
import { DaffSidebarMode } from '@daffodil/design'; | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'design-land-sidebar', | ||
templateUrl: './sidebar.component.html', | ||
styleUrls: ['./sidebar.component.scss'], | ||
}) | ||
export class DesignLandSidebarComponent { | ||
mode: DaffSidebarMode = 'push'; | ||
open = false; | ||
} | ||
export class DesignLandSidebarComponent {} |
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,9 @@ | ||
{ | ||
"$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/design/sidebar/examples", | ||
"deleteDestPath": false, | ||
"lib": { | ||
"entryFile": "src/index.ts", | ||
"styleIncludePaths": ["../../src/scss"] | ||
} | ||
} |
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,3 @@ | ||
{ | ||
"name": "@daffodil/design/sidebar/examples" | ||
} |
11 changes: 11 additions & 0 deletions
11
libs/design/sidebar/examples/src/basic-sidebar/basic-sidebar.component.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,11 @@ | ||
<daff-sidebar-viewport> | ||
<daff-sidebar> | ||
<a daff-link-set-item routerLink="accordion">Accordion</a><br> | ||
<a daff-link-set-item routerLink="article">Article</a><br> | ||
</daff-sidebar> | ||
<div> | ||
<nav daff-navbar> | ||
<div>Basic Sidebar</div> | ||
</nav> | ||
</div> | ||
</daff-sidebar-viewport> |
15 changes: 15 additions & 0 deletions
15
libs/design/sidebar/examples/src/basic-sidebar/basic-sidebar.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
// eslint-disable-next-line @angular-eslint/component-selector | ||
selector: 'basic-sidebar', | ||
templateUrl: './basic-sidebar.component.html', | ||
styles: ['daff-sidebar-viewport { height: 300px }'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class BasicSidebarComponent { | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
libs/design/sidebar/examples/src/basic-sidebar/basic-sidebar.module.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,22 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { | ||
DaffSidebarModule, | ||
DaffNavbarModule, | ||
} from '@daffodil/design'; | ||
|
||
import { BasicSidebarComponent } from './basic-sidebar.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
DaffSidebarModule, | ||
DaffNavbarModule, | ||
], | ||
declarations: [ | ||
BasicSidebarComponent, | ||
], | ||
exports: [ | ||
BasicSidebarComponent, | ||
], | ||
}) | ||
export class BasicSidebarModule { } |
21 changes: 21 additions & 0 deletions
21
.../design/sidebar/examples/src/fixed-and-over-sidebar/fixed-and-over-sidebar.component.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,21 @@ | ||
<daff-sidebar-viewport class="viewport" (backdropClicked)="closeOverSidebar()"> | ||
<daff-sidebar mode="side-fixed" [open]="true"> | ||
<a daff-link-set-item routerLink="accordion">Accordion</a><br> | ||
<a daff-link-set-item routerLink="article">Article</a><br> | ||
</daff-sidebar> | ||
<daff-sidebar mode="over" side="right" [open]="overOpen"> | ||
<a daff-link-set-item routerLink="accordion">Accordion</a><br> | ||
<a daff-link-set-item routerLink="article">Article</a><br> | ||
</daff-sidebar> | ||
<div> | ||
<nav daff-navbar> | ||
<button daff-button (click)="openOverSidebar()"> | ||
Open | ||
</button> | ||
</nav> | ||
<div class="inner-layout"> | ||
<div class="filler">Content</div> | ||
<div class="inner-sticky">Some Other Content</div> | ||
</div> | ||
</div> | ||
</daff-sidebar-viewport> |
24 changes: 24 additions & 0 deletions
24
.../design/sidebar/examples/src/fixed-and-over-sidebar/fixed-and-over-sidebar.component.scss
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,24 @@ | ||
nav { | ||
justify-content: flex-end; | ||
} | ||
daff-sidebar-viewport { height: 300px } | ||
|
||
|
||
.inner-layout { | ||
position: relative; | ||
display: flex; | ||
} | ||
|
||
.filler { | ||
flex-grow: 1; | ||
height: 600px; | ||
padding: 0 16px; | ||
} | ||
|
||
.inner-sticky { | ||
position: sticky; | ||
padding: 20px; | ||
top: 0; | ||
height: 200px; | ||
width: 300px; | ||
} |
Oops, something went wrong.