-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(settings): redesign setting sidebar (#1982)
- Loading branch information
1 parent
47d232b
commit a73662f
Showing
12 changed files
with
210 additions
and
29 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
97 changes: 97 additions & 0 deletions
97
src/app/@theme/components/toggle-settings-button/toggle-settings-button.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,97 @@ | ||
@import '../../styles/themes'; | ||
@import '~bootstrap/scss/mixins/breakpoints'; | ||
@import '~@nebular/theme/styles/global/breakpoints'; | ||
|
||
@include nb-install-component() { | ||
.toggle-settings { | ||
position: fixed; | ||
top: 50%; | ||
height: 8.575rem; | ||
width: 8.575rem; | ||
border: none; | ||
transition: transform 0.3s ease, background-image 0.3s ease; | ||
transform: translate(0, -50%); | ||
z-index: 998; | ||
|
||
@include nb-ltr() { | ||
border-top-left-radius: nb-theme(radius); | ||
border-bottom-left-radius: nb-theme(radius); | ||
right: 0; | ||
|
||
&.sidebarEnd { | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
right: auto; | ||
border-top-right-radius: nb-theme(radius); | ||
border-bottom-right-radius: nb-theme(radius); | ||
left: 0; | ||
} | ||
} | ||
|
||
@include nb-rtl() { | ||
border-top-right-radius: nb-theme(radius); | ||
border-bottom-right-radius: nb-theme(radius); | ||
left: 0; | ||
|
||
&.sidebarEnd { | ||
border-top-right-radius: 0; | ||
border-bottom-right-radius: 0; | ||
left: auto; | ||
border-top-left-radius: nb-theme(radius); | ||
border-bottom-left-radius: nb-theme(radius); | ||
right: 0; | ||
} | ||
} | ||
|
||
&.expanded { | ||
@include nb-ltr(transform, translate(-19rem, -50%)); | ||
@include nb-rtl(transform, translate(19rem, -50%)); | ||
|
||
&.sidebarEnd { | ||
@include nb-rtl(transform, translate(-19rem, -50%)); | ||
@include nb-ltr(transform, translate(19rem, -50%)); | ||
} | ||
} | ||
|
||
@include nb-for-theme(cosmic) { | ||
box-shadow: 0 0 3.4285rem 0 rgba(19, 19, 94, 0.72); | ||
background-image: linear-gradient(to right, #a054fe 0%, #7a58ff 100%); | ||
|
||
&.expanded { | ||
background-image: linear-gradient(to right, #2f296b 0%, #2f296b 100%); | ||
} | ||
} | ||
|
||
@include nb-for-theme(default) { | ||
border: 1px solid #d5dbe0; | ||
box-shadow: 0 8px 24px 0 rgba(48, 59, 67, 0.15); | ||
background-color: #ffffff; | ||
} | ||
|
||
@include nb-for-theme(corporate) { | ||
border: 1px solid #d5dbe0; | ||
box-shadow: 0 8px 24px 0 rgba(48, 59, 67, 0.15); | ||
color: nb-theme(color-danger); | ||
background-color: #ffffff; | ||
} | ||
|
||
i { | ||
font-size: 6rem; | ||
color: #ffffff; | ||
|
||
@include nb-for-theme(default) { | ||
color: nb-theme(color-danger); | ||
} | ||
|
||
@include nb-for-theme(corporate) { | ||
color: nb-theme(color-warning); | ||
} | ||
} | ||
} | ||
|
||
@include media-breakpoint-down(sm) { | ||
.toggle-settings { | ||
display: none; | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/app/@theme/components/toggle-settings-button/toggle-settings-button.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,33 @@ | ||
import { Component } from '@angular/core'; | ||
import { NbSidebarService } from '@nebular/theme'; | ||
import { StateService } from '../../../@core/utils'; | ||
|
||
@Component({ | ||
selector: 'ngx-toggle-settings-button', | ||
styleUrls: ['./toggle-settings-button.component.scss'], | ||
template: ` | ||
<button class="toggle-settings" | ||
(click)="toggleSettings()" | ||
[class.expanded]="expanded" | ||
[class.sidebarEnd]="sidebarEnd"> | ||
<i class="nb-gear"></i> | ||
</button> | ||
`, | ||
}) | ||
export class ToggleSettingsButtonComponent { | ||
|
||
sidebarEnd = false; | ||
expanded = false; | ||
|
||
constructor(private sidebarService: NbSidebarService, protected stateService: StateService) { | ||
this.stateService.onSidebarState() | ||
.subscribe(({id}) => { | ||
this.sidebarEnd = id === 'end'; | ||
}); | ||
} | ||
|
||
toggleSettings() { | ||
this.sidebarService.toggle(false, 'settings-sidebar'); | ||
this.expanded = !this.expanded; | ||
} | ||
} |
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