Skip to content

feat(chip): add dynamic type support - #27868

Merged
mapsandapps merged 27 commits into
FW-4146from
FW-4425
Aug 8, 2023
Merged

feat(chip): add dynamic type support#27868
mapsandapps merged 27 commits into
FW-4146from
FW-4425

Conversation

@mapsandapps

@mapsandapps mapsandapps commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Issue number: N/A


What is the current behavior?

The chip component does not support dynamic type.

What is the new behavior?

The chip component supports dynamic type, has a dynamic height, has min and max font sizes in ios mode, and has a screenshot test.

md mode

Small md mode:
md-small

Medium md mode:
md-medium

Large md mode:
md-large

ios mode

Small ios mode:
ios-small

Medium ios mode:
ios-medium

Large ios mode:
ios-large

Does this introduce a breaking change?

  • Yes
  • No

Other information

This also fixes an existing bug that the contents of a chip could get smooshed if the chip doesn't have enough horizontal space for its contents.

Before

rStll

After

Screenshot 2023-08-02 at 5 00 39 PM

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: core @ionic/core package label Jul 26, 2023
Comment thread core/src/components/chip/chip.scss Outdated
// --------------------------------------------------

/// @prop - Font size of the chip
$chip-ios-font-size: clamp(13px, 0.875rem, 22px);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure where to get the min & max values from. I did some quick searching and couldn't find any iOS spec for chip font sizes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me.

@mapsandapps
mapsandapps marked this pull request as ready for review July 26, 2023 20:28
@mapsandapps
mapsandapps requested review from a team and thetaPC and removed request for a team July 26, 2023 20:30
@liamdebeasi
liamdebeasi self-requested a review July 26, 2023 21:13
Comment thread core/src/components/chip/chip.scss Outdated
Comment thread core/src/components/chip/chip.ios.scss Outdated
Comment thread core/src/components/chip/chip.scss
Comment thread core/src/components/chip/chip.scss Outdated
@github-actions github-actions Bot added package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Aug 2, 2023
@github-actions github-actions Bot removed package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Aug 3, 2023
@mapsandapps

Copy link
Copy Markdown
Contributor Author

oof, i accidentally pulled main (again) and then had to force-push to fix it. sorry y'all 😕

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

configs({ directions: ['ltr'], modes: ['ios', 'md'] }).forEach(({ title, screenshot, config }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
configs({ directions: ['ltr'], modes: ['ios', 'md'] }).forEach(({ title, screenshot, config }) => {
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {

Our test infra defaults to testing both md and ios

Comment thread core/src/components/chip/chip.scss
@liamdebeasi

Copy link
Copy Markdown
Contributor

I think the changed screenshots are left over from the first update screenshots job, but the diff threshold is so small that Playwright isn't picking it up. I reverted them in 5db6f1c to see if they are needed. However, if they are indeed needed I'll revert the commit

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!

@mapsandapps
mapsandapps merged commit 8fae6da into FW-4146 Aug 8, 2023
@mapsandapps
mapsandapps deleted the FW-4425 branch August 8, 2023 15:04
sean-perkins pushed a commit that referenced this pull request Aug 18, 2023
Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->
The chip component does not support dynamic type.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
The chip component supports dynamic type, has a dynamic height, has min
and max font sizes in `ios` mode, and has a screenshot test.

### md mode

Small md mode:
<img width="1368" alt="md-small"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/4466c1b6-6d01-4ec8-8de9-0eb71fa45223">


Medium md mode:
<img width="1371" alt="md-medium"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/c51c324e-a3b7-486b-9f68-84b0e4146570">


Large md mode:
<img width="1369" alt="md-large"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/166e1229-96b7-4270-9ef2-4c708776691e">


 
### ios mode
Small ios mode:
<img width="1371" alt="ios-small"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/de240058-5fe5-4387-8481-d695950853db">


Medium ios mode:
<img width="1371" alt="ios-medium"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/c63db4be-e813-4917-a525-02ec456849ea">


Large ios mode:
<img width="1370" alt="ios-large"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/3479f619-82c8-4645-85f7-2725ea43de00">



## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

This also fixes an existing bug that the contents of a chip could get
smooshed if the chip doesn't have enough horizontal space for its
contents.

### Before
<img width="253" alt="rStll"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/9a8f4c30-ceef-4fe1-a600-38b2f01c4e68">


### After
<img width="253" alt="Screenshot 2023-08-02 at 5 00 39 PM"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/e82e17c3-91e3-4089-a57b-16c7d7b386fb">

---------

Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants