Skip to content
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

Closed

Conversation

Mallikki
Copy link
Contributor

@Mallikki Mallikki commented Oct 9, 2018

ISSUES CLOSED: #758

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the new behavior?

Implementation of the minimap component

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@Mallikki Mallikki requested a review from christophercr October 9, 2018 12:10
@Mallikki Mallikki force-pushed the feature/stark-ui-minimap branch 2 times, most recently from e3ad003 to a95b540 Compare October 9, 2018 12:54
Copy link
Collaborator

@christophercr christophercr left a 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"
Copy link
Collaborator

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"
Copy link
Collaborator

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"
Copy link
Collaborator

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:
Copy link
Collaborator

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.
Copy link
Collaborator

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
Copy link
Collaborator

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">
Copy link
Collaborator

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 {
Copy link
Collaborator

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());
Copy link
Collaborator

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);
Copy link
Collaborator

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

@Mallikki Mallikki force-pushed the feature/stark-ui-minimap branch 2 times, most recently from 22a3322 to 14fc6d1 Compare October 16, 2018 13:56
@Mallikki
Copy link
Contributor Author

Still need to fix the mysterious do-not-want-to-uncheck-the-box issue with @christophercr ;)

@Mallikki Mallikki force-pushed the feature/stark-ui-minimap branch 3 times, most recently from 6c6c099 to ff063f5 Compare October 18, 2018 14:18
@coveralls
Copy link

coveralls commented Oct 18, 2018

Coverage Status

Coverage increased (+1.9%) to 93.28% when pulling 0a0d8a5 on Mallikki:feature/stark-ui-minimap into 290934c on NationalBankBelgium:master.

<button mat-button class="mat-icon-button stark-minimap-dropdown-toggle-button"
(click)="toggleDropdownMenu()"
aria-label="Toggle columns"
[matTooltip]="'STARK.TABLE.TOGGLE_COLUMNS' | translate">
Copy link
Collaborator

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">
Copy link
Collaborator

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:
Copy link
Collaborator

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.
Copy link
Collaborator

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">
Copy link
Collaborator

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
})
Copy link
Collaborator

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;
Copy link
Collaborator

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

@Mallikki Mallikki force-pushed the feature/stark-ui-minimap branch from ff063f5 to 0a0d8a5 Compare October 29, 2018 08:16
@Mallikki Mallikki force-pushed the feature/stark-ui-minimap branch from 0a0d8a5 to 7875201 Compare November 5, 2018 07:25
@Mallikki Mallikki closed this Nov 5, 2018
@Mallikki
Copy link
Contributor Author

Mallikki commented Nov 5, 2018

Will reopen with another branch, the changes are the same, I've messed up, sorry :/

@christophercr
Copy link
Collaborator

Re-created in #824

@Mallikki Mallikki deleted the feature/stark-ui-minimap branch December 11, 2018 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui: minimap - implement component/module
3 participants