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(block): display correct header spacing when heading or description are present #9924

Merged

Conversation

aPreciado88
Copy link
Contributor

@aPreciado88 aPreciado88 commented Jul 31, 2024

Related Issue: #9920

Summary

Update block component to display correct header spacing when heading or description properties are present.

@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Jul 31, 2024
@aPreciado88 aPreciado88 added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Jul 31, 2024
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

Changes look good, just missing a few things 👍

@@ -194,7 +198,6 @@ calcite-action-menu {
}
}

:host([heading]),
:host([description]) {
Copy link
Member

Choose a reason for hiding this comment

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

[description] would also be an issue here because it isn't reflected either. Should this css be removed?

@@ -416,7 +416,7 @@ export class Block
const toggleLabel = open ? messages.collapse : messages.expand;

const headerContent = (
<header class={CSS.header} id={IDS.header}>
<header class={{ [CSS.header]: true, [CSS.headerPadding]: !!heading }} id={IDS.header}>
Copy link
Member

Choose a reason for hiding this comment

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

should this be !!(heading || description)?

Suggested change
<header class={{ [CSS.header]: true, [CSS.headerPadding]: !!heading }} id={IDS.header}>
<header class={{ [CSS.header]: true, [CSS.headerPadding]: !!(heading || description) }} id={IDS.header}>

@@ -23,6 +23,10 @@
@apply justify-start;
}

.header-padding {
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: maybe this should be named something like .header--present or .header--enabled?

@aPreciado88
Copy link
Contributor Author

@driskull I noticed that if I update the heading prop in block.tsx to @Prop({ reflect: true }) heading!: string; then the css will work, without any of the changes above. Is there a reason why it's declared as @Prop() heading!: string; ?
description is also declared as @Prop() description: string;. Should the fix be to add { reflect: true } to both props?

@driskull
Copy link
Member

@aPreciado88 no, we don't want to reflect all properties. In cases where the property is just content , we don't want to reflect. https://github.com/Esri/calcite-design-system/tree/dev/packages/calcite-components/conventions#reflecting-to-attributes

driskull and others added 3 commits July 31, 2024 16:36
…esent' of github.com:Esri/calcite-design-system into aPreciado88/9920-spacing-not-honored-when-heading-is-present
@aPreciado88 aPreciado88 requested a review from driskull July 31, 2024 23:52
@aPreciado88
Copy link
Contributor Author

@driskull I updated with the requested changes.

@aPreciado88 aPreciado88 changed the title fix(block): display correct header spacing when heading is present fix(block): display correct header spacing when heading or description are present Jul 31, 2024
@aPreciado88 aPreciado88 added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jul 31, 2024
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

@aPreciado88 can we add a e2e test that checks for the css class when a heading or description is present via their properties?

Changes look good to me. Lets wait for @jcfranco to review before merging.

Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

Once we have screenshot test coverage, this is good to merge! 🚀

@@ -23,6 +23,10 @@
@apply justify-start;
}

.header--present {
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: I believe we use .<part>--has-text in other components for similar contexts.

@@ -323,6 +323,29 @@ describe("calcite-block", () => {
const actionAssignedSlot = await page.$eval("calcite-action", (action) => action.assignedSlot.name);
expect(actionAssignedSlot).toBe(SLOTS.headerMenuActions);
});

it("applies correct header spacing when heading or description properties are present", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now until we add extra checks to ensure styles use reflected props. After that, we should rely on screenshot tests. From the assertion perspective, it is not guaranteed that changes in the CSS class will be detected by this test, meaning its implementation could change without causing a test failure. cc @driskull

Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

This is a sufficient test for now but ideally a screenshot test should be the real test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jcfranco Should I create a follow up issue to add a screenshot test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jcfranco I created this follow up issue to remove this E2E test once the reflected prop checks are in place.

@aPreciado88 aPreciado88 added pr ready for visual snapshots Adding this label will run visual snapshot testing. skip visual snapshots Pull requests that do not need visual regression testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Aug 1, 2024
@aPreciado88 aPreciado88 merged commit 23d67b4 into dev Aug 1, 2024
15 checks passed
@aPreciado88 aPreciado88 deleted the aPreciado88/9920-spacing-not-honored-when-heading-is-present branch August 1, 2024 19:40
@github-actions github-actions bot added this to the 2.11.1 patch milestone Aug 1, 2024
benelan pushed a commit that referenced this pull request Aug 2, 2024
…n are present (#9924)

**Related Issue:**
[#9920](#9920)

## Summary
Update `block` component to display correct header spacing when
`heading` or `description` properties are present.

---------

Co-authored-by: Matt Driscoll <[email protected]>
benelan pushed a commit that referenced this pull request Aug 2, 2024
…n are present (#9924)

**Related Issue:**
[#9920](#9920)

## Summary
Update `block` component to display correct header spacing when
`heading` or `description` properties are present.

---------

Co-authored-by: Matt Driscoll <[email protected]>
benelan pushed a commit that referenced this pull request Aug 2, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>@esri/calcite-components: 2.11.1</summary>

##
[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)


### Bug Fixes

* **block:** Display correct header spacing when heading or description
are present
([#9924](#9924))
([d8f1077](d8f1077))
* **panel, flow-item:** Fix header padding regression
([#9936](#9936))
([90e9368](90e9368))
</details>

<details><summary>@esri/calcite-components-angular: 2.11.1</summary>

##
[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)


### Miscellaneous Chores

* **@esri/calcite-components-angular:** Synchronize components versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @esri/calcite-components bumped from ^2.11.0 to ^2.11.1
</details>

<details><summary>@esri/calcite-components-react: 2.11.1</summary>

##
[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)


### Miscellaneous Chores

* **@esri/calcite-components-react:** Synchronize components versions


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @esri/calcite-components bumped from ^2.11.0 to ^2.11.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
benelan pushed a commit that referenced this pull request Aug 2, 2024
🤖 I have created a release *beep* *boop*
---

<details><summary>@esri/calcite-components: 2.11.1</summary>

[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)

* **block:** Display correct header spacing when heading or description
are present
([#9924](#9924))
([d8f1077](d8f1077))
* **panel, flow-item:** Fix header padding regression
([#9936](#9936))
([90e9368](90e9368))
</details>

<details><summary>@esri/calcite-components-angular: 2.11.1</summary>

[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)

* **@esri/calcite-components-angular:** Synchronize components versions

* The following workspace dependencies were updated
  * dependencies
    * @esri/calcite-components bumped from ^2.11.0 to ^2.11.1
</details>

<details><summary>@esri/calcite-components-react: 2.11.1</summary>

[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)

* **@esri/calcite-components-react:** Synchronize components versions

* The following workspace dependencies were updated
  * dependencies
    * @esri/calcite-components bumped from ^2.11.0 to ^2.11.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
benelan added a commit that referenced this pull request Aug 2, 2024
**Related Issue:** #9952

## Summary

Cherry-pick the release commit from `main`.

---

<details><summary>@esri/calcite-components: 2.11.1</summary>


[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)

* **block:** Display correct header spacing when heading or description
are present
([#9924](#9924))

([d8f1077](d8f1077))
* **panel, flow-item:** Fix header padding regression
([#9936](#9936))

([90e9368](90e9368))
</details>

<details><summary>@esri/calcite-components-angular: 2.11.1</summary>


[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)

* **@esri/calcite-components-angular:** Synchronize components versions

* The following workspace dependencies were updated
  * dependencies
    * @esri/calcite-components bumped from ^2.11.0 to ^2.11.1
</details>

<details><summary>@esri/calcite-components-react: 2.11.1</summary>


[2.11.1](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected])
(2024-08-02)

* **@esri/calcite-components-react:** Synchronize components versions

* The following workspace dependencies were updated
  * dependencies
    * @esri/calcite-components bumped from ^2.11.0 to ^2.11.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See

[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Calcite Admin <[email protected]>
@benelan benelan mentioned this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports for broken functionality. Issues should include a reproduction of the bug. skip visual snapshots Pull requests that do not need visual regression testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants