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

fix: make tokenizer/multiinput responsive #2086

Merged
merged 48 commits into from
Apr 9, 2020

Conversation

mikerodonnell89
Copy link
Member

@mikerodonnell89 mikerodonnell89 commented Feb 28, 2020

Please provide a link to the associated issue.

fixes #2018

Please provide a brief summary of this pull request.

Collapse/expand tokens within the tokenizer depending on tokenizer width. Multi-input should display "____ more" text indicating how many collapsed tokens there are. Also refactor the breadcrumb responsiveness a little bit.

Please check whether the PR fulfills the following requirements

@mikerodonnell89 mikerodonnell89 requested a review from a team February 28, 2020 19:23
@netlify
Copy link

netlify bot commented Feb 28, 2020

Deploy preview for fundamental-ngx ready!

Built with commit 6788f2d

https://deploy-preview-2086--fundamental-ngx.netlify.com

@estelaxu3
Copy link

I notice that if I delete the items in tokenizer, the label "x more" doesn't change. If I added 5 items, it will say "5 more" even when I delete everything.
Screen Shot 2020-03-04 at 4 37 13 PM

@stefanoScalzo
Copy link
Contributor

Uploading Screen Shot 2020-03-04 at 7.31.48 PM.png…
dont think we should allow empty tokens, it creates weird spacing

@mikerodonnell89 mikerodonnell89 changed the title fix: responsive tokenizer [WIP] fix: responsive tokenizer Mar 5, 2020
@mikerodonnell89 mikerodonnell89 changed the title [WIP] fix: responsive tokenizer fix: responsive tokenizer Mar 6, 2020
@mikerodonnell89 mikerodonnell89 changed the title fix: responsive tokenizer fix: make tokenizer responsive Mar 6, 2020
@mikerodonnell89 mikerodonnell89 changed the title fix: make tokenizer responsive [WIP] fix: make tokenizer responsive Mar 6, 2020
@mikerodonnell89 mikerodonnell89 changed the title [WIP] fix: make tokenizer responsive [WIP] fix: make tokenizer/multiinput responsive Mar 9, 2020
@mikerodonnell89
Copy link
Member Author

Depends on SAP/fundamental-styles#775

@mikerodonnell89 mikerodonnell89 self-assigned this Mar 13, 2020
@mikerodonnell89 mikerodonnell89 added the blocked blocked ticket label Apr 7, 2020
@mikerodonnell89 mikerodonnell89 changed the title fix: make tokenizer/multiinput responsive [blocked] fix: make tokenizer/multiinput responsive Apr 7, 2020
@mikerodonnell89
Copy link
Member Author

Should have left this as blocked as it depends on #2228

@estelaxu3
Copy link

The cozy mode can't be fold into "(x) more"
Screen Shot 2020-04-07 at 10 44 51 AM

@mikerodonnell89
Copy link
Member Author

The cozy mode can't be fold into "(x) more"
Screen Shot 2020-04-07 at 10 44 51 AM

this is according to the designs

@mikerodonnell89 mikerodonnell89 changed the title [blocked] fix: make tokenizer/multiinput responsive fix: make tokenizer/multiinput responsive Apr 7, 2020
@mikerodonnell89 mikerodonnell89 removed the blocked blocked ticket label Apr 7, 2020
@mikerodonnell89
Copy link
Member Author

This PR is changing many other files not just Tokenizer/MultiInput. Is it intentional?

A lot of the changes came from #2228 which has now been merged so you should be seeing fewer. There are still some seemingly random changes, like one to breadcrumb, but i did that because the tokenizer and breadcrumb resize logic is very similar.

@InnaAtanasova
Copy link
Contributor

Screen Shot 2020-04-07 at 4 19 31 PM

Screen Shot 2020-04-07 at 4 18 38 PM

Mutli Input - there is a spacing on the right side of the button

Screen Shot 2020-04-07 at 4 20 14 PM

The focus outline is cut

Screen Shot 2020-04-07 at 4 20 37 PM

For MultiInput I think the button addon should be always visible. Now when you add more tokens it hides.

The Token has cut focus outline:
Screen Shot 2020-04-07 at 4 21 09 PM

Shouldn't clicking on __more button open a dropdown with all Tokens?

Development automation moved this from In progress to Review in progress Apr 8, 2020
Copy link
Contributor

@JKMarkowski JKMarkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Mike, let's take a look at my comments. The example works well, but there are some changes to include in the code

Comment on lines 44 to 56
buildComponentCssClass(): string {
return [
this.state ? 'is-' + this.state : '',
this.type === 'radio' ? 'fd-radio' : '',
this._getElementTag() === 'input' ? 'fd-input' : '',
this._getElementTag() === 'textarea' ? 'fd-textarea' : '',
this._getElementTag() === 'select' ? 'fd-form-select' : '',
this.compact && this._getElementTag() === 'input' ? 'fd-input--compact' : '',
this.compact && this._getElementTag() === 'textarea' ? 'fd-textarea--compact' : '',
this.compact && this._getElementTag() === 'select' ? 'fd-form-select--compact' : '',
this.class
].filter(x => x !== '').join(' ');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have some method there?

Suggested change
buildComponentCssClass(): string {
return [
this.state ? 'is-' + this.state : '',
this.type === 'radio' ? 'fd-radio' : '',
this._getElementTag() === 'input' ? 'fd-input' : '',
this._getElementTag() === 'textarea' ? 'fd-textarea' : '',
this._getElementTag() === 'select' ? 'fd-form-select' : '',
this.compact && this._getElementTag() === 'input' ? 'fd-input--compact' : '',
this.compact && this._getElementTag() === 'textarea' ? 'fd-textarea--compact' : '',
this.compact && this._getElementTag() === 'select' ? 'fd-form-select--compact' : '',
this.class
].filter(x => x !== '').join(' ');
}
buildComponentCssClass(): string {
return [
this.state ? 'is-' + this.state : '',
this._getFormClass(),
this.compact ? (this._getFormClass() + '--compact') : '',
this.class
].filter(x => x !== '').join(' ');
}
private _getFormClass(): string {
switch (this._getElementTag()) {
case: 'input':
return `fd-input`;
case: 'select':
...
}
}

}

/** @hidden */
expandTokens(): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it private?

}

/** @hidden */
collapseTokens(side?: string): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it private?

/** @hidden */
focusTokenElement(event: KeyboardEvent, newIndex: number): HTMLElement {
focusTokenElement(event: Event, newIndex: number): HTMLElement {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order of methods rules should be followed, take a look there

<ng-content select="fd-token"></ng-content>
<span *ngIf="(moreTokensLeft.length > 0 || moreTokensRight.length > 0) && compact" class="fd-tokenizer-more" #moreElement>
<ng-container>{{moreTokensLeft.length + moreTokensRight.length}} more</ng-container>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put some customizable {{word}}, instead of more?

<ng-content select="fd-token"></ng-content>
<span *ngIf="(moreTokensLeft.length > 0 || moreTokensRight.length > 0) && compact" class="fd-tokenizer-more" #moreElement>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's good idea to depend behaviour on compact flag. Maybe let's have another better docummented flag like collapseTokens: boolean or something. It would be great to put some dedicated section only for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you saying collapseTokens would be an input or somehow behave separately from the compact flag? The specs make it pretty clear that phones are cozy and don't have "more" text and desktop is compact and does have "more" so I don't think we should deviate from that

@JKMarkowski JKMarkowski self-requested a review April 9, 2020 13:30
Development automation moved this from Review in progress to Reviewer approved Apr 9, 2020
@mikerodonnell89 mikerodonnell89 merged commit 35d50ec into master Apr 9, 2020
Development automation moved this from Reviewer approved to Done Apr 9, 2020
@droshev droshev deleted the fix/responsive-tokenizer branch April 10, 2020 14: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.

responsive tokenizer
7 participants