-
Notifications
You must be signed in to change notification settings - Fork 3
feat(sidebar): refactored module (#DS-3649) #736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
artembelik
wants to merge
3
commits into
main
Choose a base branch
from
feat/DS-3649
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+764
−550
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,45 +1,29 @@ | ||
import { JsonPipe } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core'; | ||
import { KbqButtonModule } from '@koobiq/components/button'; | ||
import { KbqSidebarModule, SidebarPositions } from '@koobiq/components/sidebar'; | ||
import { Direction, KbqSplitterModule } from '@koobiq/components/splitter'; | ||
import { SidebarExamplesModule } from 'packages/docs-examples/components/sidebar'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [SidebarExamplesModule], | ||
selector: 'dev-examples', | ||
template: ` | ||
<sidebar-overview-example /> | ||
<hr /> | ||
<sidebar-with-splitter-example /> | ||
<hr /> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class DevExamples {} | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
KbqSplitterModule, | ||
KbqButtonModule, | ||
KbqSidebarModule, | ||
JsonPipe | ||
DevExamples | ||
], | ||
selector: 'dev-app', | ||
templateUrl: './template.html', | ||
styleUrls: ['./styles.scss'], | ||
styleUrl: './styles.scss', | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class DevApp { | ||
direction = Direction; | ||
sidebarPositions = SidebarPositions; | ||
|
||
leftSidebarSidebarState: boolean = false; | ||
leftSplitterState: boolean = false; | ||
|
||
rightSidebarSidebarState: boolean = false; | ||
|
||
onStateChanged($event): void { | ||
console.log('onStateChanged: ', $event); | ||
} | ||
|
||
toggleLeftSidebar() { | ||
this.leftSidebarSidebarState = !this.leftSidebarSidebarState; | ||
} | ||
|
||
toggleRightSidebar() { | ||
this.rightSidebarSidebarState = !this.rightSidebarSidebarState; | ||
} | ||
|
||
toggleLeftSplitterState() { | ||
this.leftSplitterState = !this.leftSplitterState; | ||
} | ||
} | ||
export class DevApp {} |
This file contains hidden or 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,25 +1 @@ | ||
dev-app { | ||
display: block; | ||
} | ||
|
||
.dev-container { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
|
||
height: 200px; | ||
} | ||
|
||
.dev-container__body { | ||
flex: 1 1 30%; | ||
|
||
background-color: antiquewhite; | ||
} | ||
|
||
.kbq-sidebar-opened { | ||
background-color: #6fba53; | ||
} | ||
|
||
.kbq-sidebar-closed { | ||
background-color: darkgray; | ||
} | ||
/* stylelint-disable-next-line no-empty-source */ |
This file contains hidden or 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,88 +1 @@ | ||
<br /> | ||
|
||
<div class="layout-row layout-align-space-between"> | ||
<div> | ||
<button kbq-button (click)="leftSidebar.toggle()">toggle by method</button> | ||
| ||
</div> | ||
|
||
<div> | ||
<button kbq-button (click)="rightSidebar.toggle()">toggle by method</button> | ||
| ||
</div> | ||
</div> | ||
|
||
<br /> | ||
<br /> | ||
|
||
<div class="dev-container layout-row layout-align-space-between"> | ||
<kbq-sidebar #leftSidebar="kbqSidebar" [position]="sidebarPositions.Left" (stateChanged)="onStateChanged($event)"> | ||
<div kbq-sidebar-opened class="kbq-sidebar-opened">kbq-sidebar-opened</div> | ||
<div kbq-sidebar-closed class="kbq-sidebar-closed">kbq-sidebar-closed</div> | ||
</kbq-sidebar> | ||
|
||
<div class="dev-container__body">main area</div> | ||
|
||
<kbq-sidebar #rightSidebar="kbqSidebar" [position]="sidebarPositions.Right" (stateChanged)="onStateChanged($event)"> | ||
<div kbq-sidebar-opened class="kbq-sidebar-opened">kbq-sidebar-opened</div> | ||
<div kbq-sidebar-closed class="kbq-sidebar-closed">kbq-sidebar-closed</div> | ||
</kbq-sidebar> | ||
</div> | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
<div class="layout-row layout-align-space-between"> | ||
<div> | ||
<button kbq-button (click)="toggleLeftSidebar()">toggle by state</button> | ||
| ||
<button kbq-button (click)="toggleLeftSplitterState()">toggle splitter state</button> | ||
| ||
</div> | ||
|
||
<div> | ||
<button kbq-button (click)="toggleRightSidebar()">toggle by state</button> | ||
| ||
</div> | ||
</div> | ||
|
||
<br /> | ||
<br /> | ||
|
||
<kbq-splitter | ||
class="dev-container layout-row layout-align-space-between" | ||
[direction]="direction.Horizontal" | ||
[disabled]="leftSplitterState" | ||
> | ||
<kbq-sidebar | ||
kbq-splitter-area | ||
[opened]="leftSidebarSidebarState" | ||
[position]="sidebarPositions.Left" | ||
(stateChanged)="onStateChanged($event)" | ||
> | ||
<div kbq-sidebar-opened class="kbq-sidebar-opened" [maxWidth]="'600px'" [minWidth]="'320px'"> | ||
kbq-sidebar-opened | ||
</div> | ||
|
||
<div kbq-sidebar-closed class="kbq-sidebar-closed" [width]="'32px'">kbq-sidebar-closed</div> | ||
</kbq-sidebar> | ||
|
||
<div kbq-splitter-area class="flex dev-container__body">main body</div> | ||
|
||
<kbq-sidebar | ||
kbq-splitter-area | ||
[opened]="rightSidebarSidebarState" | ||
[position]="sidebarPositions.Right" | ||
(stateChanged)="onStateChanged($event)" | ||
> | ||
<div kbq-sidebar-opened class="kbq-sidebar-opened">kbq-sidebar-opened</div> | ||
<div kbq-sidebar-closed class="kbq-sidebar-closed">kbq-sidebar-closed</div> | ||
</kbq-sidebar> | ||
</kbq-splitter> | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
|
||
<div>{{ leftSidebar.params | json }}</div> | ||
<dev-examples /> |
39 changes: 39 additions & 0 deletions
39
packages/components/sidebar/__snapshots__/sidebar.spec.ts.snap
This file contains hidden or 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,39 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`KbqSidebar should match snapshot when closed 1`] = ` | ||
DebugElement { | ||
"nativeNode": <kbq-sidebar | ||
class="kbq-sidebar ng-trigger ng-trigger-state" | ||
style="min-width: 32px; width: 32px; max-width: 32px;" | ||
> | ||
|
||
<div | ||
class="kbq-sidebar-closed" | ||
kbqsidebarclosed="" | ||
style="" | ||
> | ||
kbqSidebarClosed | ||
</div> | ||
|
||
</kbq-sidebar>, | ||
} | ||
`; | ||
|
||
exports[`KbqSidebar should match snapshot when opened 1`] = ` | ||
DebugElement { | ||
"nativeNode": <kbq-sidebar | ||
class="kbq-sidebar ng-trigger ng-trigger-state" | ||
style="min-width: inherit; width: inherit; max-width: inherit;" | ||
> | ||
<div | ||
class="kbq-sidebar-opened" | ||
kbqsidebaropened="" | ||
style="" | ||
> | ||
kbqSidebarOpened | ||
</div> | ||
|
||
|
||
</kbq-sidebar>, | ||
} | ||
`; |
This file contains hidden or 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,5 +1,3 @@ | ||
🚧 **Documentation in progress** 🚧 | ||
### With splitter | ||
|
||
Unfortunately, the documentation for this section is not ready yet. We are actively working on its creation and plan to add it soon. | ||
|
||
If you would like to contribute to the documentation or have any questions, please feel free to [open an issue](https://github.com/koobiq/angular-components/issues) in our GitHub repository. | ||
<!-- example(sidebar-with-splitter) --> |
This file contains hidden or 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,5 +1,3 @@ | ||
🚧 **Документация в процессе написания** 🚧 | ||
### Со сплиттером | ||
|
||
К сожалению, документация для этого раздела еще не готова. Мы активно работаем над ее созданием и планируем добавить в ближайшее время. | ||
|
||
Если вы хотите помочь в написании документации или у вас есть вопросы, пожалуйста, [создайте issue](https://github.com/koobiq/angular-components/issues) в нашем репозитории на GitHub. | ||
<!-- example(sidebar-with-splitter) --> |
This file contains hidden or 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,2 +1,2 @@ | ||
export * from './sidebar.component'; | ||
export * from './sidebar'; | ||
export * from './sidebar.module'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmnturov нужна svg иконка