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(panel): apply custom styles correctly to header actions #11495

Merged
merged 20 commits into from
Feb 26, 2025

Conversation

alisonailea
Copy link
Contributor

@alisonailea alisonailea commented Feb 7, 2025

Related Issue: #11491 #8675 #7180

Summary

Allow calcite-actions to be styled specific to the panel-header.
include ::slotted(calcite-action) in selectors and set proper variable fallbacks
Correctly pass corner-radius through the component

@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Feb 7, 2025
@alisonailea alisonailea added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Feb 7, 2025
@macandcheese
Copy link
Contributor

macandcheese commented Feb 7, 2025

My 2c - supporting css parts has been discussed and we decided not to pursue for the near-term. It's a significant shift in customization story.

The css token approach seems more on-story here - I do think it could perhaps be simplified to just target the internally rendered Actions and Action Menu - keeping your new props here and making the user story this:

  .my-great-panel {
    --calcite-panel-header-action-background-color: blue;
    --calcite-panel-header-action-background-color-hover: blue;
    --calcite-panel-header-action-background-color-press: blue;
     etc...
  }

  .my-great-panel calcite-action[slot="header-actions-end"] {
    --calcite-action-background-color: blue;
    --calcite-action-background-color-hover: blue;
    --calcite-action-background-color-press: blue;
    etc... 
  }

This way, a user would just need to style Actions slotted in header-actions-end - internally rendered Action and internally rendered Action Menu for the header-menu-actions slot are handled through the new Panel props you added here, and users wouldn't need to reset any Actions slotted elsewhere in the Panel.

Example : https://github.com/Esri/calcite-design-system/blob/macandcheese/wip-panel-tokens-idea/packages/calcite-components/src/components/panel/panel.scss - this would mean we could remove the "pass through docs" for Action props on Panel to reduce confusion.

@driskull
Copy link
Member

I agree with @macandcheese here.

@alisonailea alisonailea marked this pull request as ready for review February 10, 2025 18:26
@jcfranco
Copy link
Member

@alisonailea Can you fix the typo in the title and update the description with details of the final approach? Thanks!

@alisonailea alisonailea changed the title fix(panel): provide progressive enhancement to target caclite-actions in header fix(panel): progressive enhancement to target calcite-actions in header Feb 10, 2025
@@ -181,6 +167,27 @@
}
}

.header {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can be more specific here, just assigning these to the internally-rendered Actions (

)

If so, we can update the css prop descriptions to specifically state the elements affected (like you have for the "part example").

@alisonailea alisonailea requested a review from jcfranco February 20, 2025 20:07
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.

Looking good, @alisonailea! 😎 One more pass and this should be good to land.

);
}

.interaction-container {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed since interaction-container uses display: contents and doesn't produce a box.

Copy link
Member

@jcfranco jcfranco Feb 26, 2025

Choose a reason for hiding this comment

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

For posterity: I restored this override as I was completely wrong on this one. display: contents doesn't have any effect on inheritance, so my suggestion broke styling.

--calcite-action-background-color-press: var(--calcite-panel-header-action-background-color-press);
--calcite-action-text-color: var(--calcite-panel-header-action-text-color);
--calcite-action-text-color-pressed: var(--calcite-panel-header-action-text-color-pressed);
}
Copy link
Member

Choose a reason for hiding this comment

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

Does --calcite-action-corner-radius need to be set here? Possibly by --calcite-internal-panel-corner-radius?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this is covered by the corner radius of the action containers.

@jcfranco jcfranco changed the title fix(panel): progressive enhancement to target calcite-actions in header fix(panel): progressive enhancement to target actions in header Feb 26, 2025
@jcfranco jcfranco changed the title fix(panel): progressive enhancement to target actions in header fix(panel): apply custom styles correctly to header actions Feb 26, 2025
@jcfranco jcfranco requested review from macandcheese and driskull and removed request for driskull and macandcheese February 26, 2025 01:49
@jcfranco jcfranco 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 Feb 26, 2025
@jcfranco jcfranco 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 Feb 26, 2025
@jcfranco jcfranco self-requested a review February 26, 2025 04:17
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.

👍

@jcfranco jcfranco merged commit fd64b84 into dev Feb 26, 2025
14 checks passed
@jcfranco jcfranco deleted the astump/panel-header branch February 26, 2025 17:50
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. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants