-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): anchors component was added (#191)
- Loading branch information
1 parent
439923a
commit 85d292e
Showing
7 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/docs/src/app/components/anchors/anchors.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,9 @@ | ||
<div class="anchors-menu"> | ||
<div class="anchors-menu__container"> | ||
<div class="anchors-menu__list" > | ||
<div *ngFor="let anchor of anchors; let i = index" [attr.class] = "i == activeAnchor? activeClass : inactiveClass" > | ||
<a href="{{anchor.href}}" (click)="setActiveAnchor(i)">{{anchor.name}}</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
27 changes: 27 additions & 0 deletions
27
packages/docs/src/app/components/anchors/anchors.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,27 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
|
||
@Component({ | ||
selector: 'anchors', | ||
templateUrl: './anchors.component.html', | ||
styleUrls: ['./anchors.scss'] | ||
}) | ||
export class AnchorsComponent { | ||
|
||
activeAnchor: number = 0; | ||
activeClass: string = "anchors-menu__list-element anchors-menu__list-element_active"; | ||
anchors: {href: string, name: string }[] = [ | ||
{href: "#variants", name: "Variants"}, | ||
{href: "#colors", name: "Colors"}, | ||
{href: "#progress-indication", name: "Progress indication"}, | ||
]; | ||
inactiveClass: string = "anchors-menu__list-element"; | ||
|
||
ngAfterViewInit() { | ||
// TODO: collect real anchors data | ||
} | ||
|
||
setActiveAnchor ( index ) { | ||
this.activeAnchor = index; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/docs/src/app/components/anchors/anchors.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,10 @@ | ||
import { AnchorsComponent } from "./anchors.component"; | ||
import {CommonModule} from "@angular/common"; | ||
import { NgModule } from '@angular/core'; | ||
|
||
@NgModule({ | ||
imports: [CommonModule], | ||
exports: [AnchorsComponent], | ||
declarations: [AnchorsComponent] | ||
}) | ||
export class AnchorsModule { } |
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 @@ | ||
@mixin box-shadow ($shadow) { | ||
-webkit-box-shadow: $shadow; | ||
-moz-box-shadow: $shadow; | ||
-o-box-shadow: $shadow; | ||
box-shadow: $shadow; | ||
} | ||
|
||
.anchors-menu { | ||
position: fixed; | ||
top: 64px; | ||
width: 350px; | ||
right: 0; | ||
bottom: 0; | ||
|
||
&__list { | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 25px; | ||
} | ||
|
||
&__list-element { | ||
list-style-type: none; | ||
padding: 6px 16px; | ||
line-height: 20px; | ||
font-size: 15px; | ||
color: #2f2f33; | ||
|
||
&:hover { @include box-shadow( inset 3px 0 0 rgba(140,148,158,0.2) ); } | ||
|
||
&_active { @include box-shadow( inset 3px 0 0 #2f80ed ); } | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
<router-outlet></router-outlet> | ||
</div> | ||
</article> | ||
<anchors></anchors> | ||
</main> |
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