-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat(stark-ui): implementation of minimap component #761
feat(stark-ui): implementation of minimap component #761
Conversation
e3ad003
to
a95b540
Compare
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.
Some remarks... and could you also add the corresponding demo page for this component in the showcase?
<div class="stark-minimap"> | ||
<div class="stark-minimap-dots"> | ||
<ul> | ||
<li *ngFor="let item of items; trackBy: $index" |
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.
Currently, Travis is failing because of this: $index
.... I think you should put a function here instead
(click)="toggleDropdownMenu()" | ||
aria-label="Toggle columns" | ||
matTooltip="'STARK.TABLE.TOGGLE_COLUMNS'" | ||
[matTooltipPosition]="below" |
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.
Currently, Travis is failing because of this line. I think it should be like this: matTooltipPosition="below"
(without square brackets)
</button> | ||
<div class="stark-minimap-dropdown-toggle-menu"> | ||
<div class="stark-minimap-dropdown"> | ||
<mat-checkbox *ngFor="let item of items; trackBy : $index" |
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.
Currently, Travis is failing because of this: $index
.... I think you should put a function here instead
* Component to display a minimap which permits to toggle the visibility of passed elements. | ||
* The minimap shows the label of the elements to display with a checkbox to enable/disable the visibility: | ||
* | ||
* @param string -mode Desired layout or flavour: |
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.
Now we put all the JSDocs in the property they belong to... so this one should be at the mode
property
* - compact: displayed in a compact form. There is only a button to trigger the dropdown. | ||
* - default: basic implementation with everything | ||
* | ||
* @param StarkMinimapItemProperties[] - items Array of StarkMinimapItemProperties objects which define the items to display in the minimap. |
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.
Now we put all the JSDocs in the property they belong to... so this one should be at the items
property
|
||
/** | ||
* triggers the show/hide event on an item | ||
* @param StarkMinimapItemProperties : item - the item to show/hide |
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.
I think this JSDoc should be like this: @param item - The item to show/hide
... because the type is already implicit in the code ;)
@@ -0,0 +1,32 @@ | |||
<div class="stark-minimap"> |
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.
Now it is not necessary to add the "stark-xxxx" class anymore... we should do this via Angular by adding this to the component class:
@Component({
selector: "stark-minimap",
templateUrl: "./minimap.component.html",
encapsulation: ViewEncapsulation.None,
host: {
class: componentName
}
})
export class StarkMinimapComponent implements OnInit, OnChanges, OnDestroy {
...
You can even remove this div at the end.
By doing all this, you might need to adapt the CSS rules as well since the hierarchy of HTML elements changed
templateUrl: "./minimap.component.html", | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class StarkMinimapComponent implements OnInit, OnChanges, OnDestroy { |
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.
Now, every UI component in Stark-UI should extend the AbstractStarkUiComponent
class, which is generic way to add the color
input to all our components to make them themable ;)
You can have a look at the DropdownComponent
how is this done
); | ||
|
||
if (!parentElement) { | ||
this.ngZoneService.run(() => this.toggleDropdownMenu()); |
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.
I don't think we need to use the ngZoneService
itself, perhaps we can achieve the same by using the ApplicationRef instead inside the toggleDropdownMenu()
method
display: inline-block; | ||
width: 4px; | ||
height: 4px; | ||
background-color: mat-color($primary-dark-text-color); |
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.
Can we move all the background-color
rules and also those using the mat-color(...)
to a separate _minimap-theme.scss
file? So those colors can be customized to make the minimap themable
22a3322
to
14fc6d1
Compare
Still need to fix the mysterious do-not-want-to-uncheck-the-box issue with @christophercr ;) |
6c6c099
to
ff063f5
Compare
<button mat-button class="mat-icon-button stark-minimap-dropdown-toggle-button" | ||
(click)="toggleDropdownMenu()" | ||
aria-label="Toggle columns" | ||
[matTooltip]="'STARK.TABLE.TOGGLE_COLUMNS' | translate"> |
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.
No [matTooltipPosition]="below"
anymore?
<button mat-button class="mat-icon-button stark-minimap-dropdown-toggle-button" | ||
(click)="toggleDropdownMenu()" | ||
aria-label="Toggle columns" | ||
[matTooltip]="'STARK.TABLE.TOGGLE_COLUMNS' | translate"> |
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.
No [matTooltipPosition]="below"
anymore?
|
||
/** | ||
* Component to display a minimap which permits to toggle the visibility of passed elements. | ||
* The minimap shows the label of the elements to display with a checkbox to enable/disable the visibility: |
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.
Typo at the end of the line ":" -> "."
Can you also remove the next empty line?
public mode?: StarkMinimapComponentMode; | ||
|
||
/** | ||
* EventEmitter to be called when call showHideItem callback. |
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.
Let's change this confusing description... what about: Output that will emit the selected element to be shown/hidden
@@ -0,0 +1,53 @@ | |||
<section *ngIf="mode === 'compact'; else classic_minimap" class="custom-minimap"> |
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.
It is better if we use different classes for the "compact" mode and for the "classic" one... instead of using the same custom-minimap
... that way it will be easier to style them separately.
The reason is that we might separate the templates as well (once we investigate a bit deeper on how to do this in Angular 5)+ 😉
selector: "stark-minimap", | ||
templateUrl: "./minimap.component.html", | ||
encapsulation: ViewEncapsulation.None | ||
}) |
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.
Can you add the host
property in here to add the stark-minimap
class to the component?
host: {
class: componentName
}
We must do this for every component in Stark UI ;)
} | ||
|
||
public ngOnInit(): void { | ||
this.isDisplayedMenu = false; |
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.
Don't forget to call super.ngOnInit()
inside this ngOnInit
so that the logic from the abstract component is also executed
ff063f5
to
0a0d8a5
Compare
ISSUES CLOSED: #758t pu
0a0d8a5
to
7875201
Compare
Will reopen with another branch, the changes are the same, I've messed up, sorry :/ |
Re-created in #824 |
ISSUES CLOSED: #758
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the new behavior?
Implementation of the minimap component
Does this PR introduce a breaking change?
Other information