Skip to content

chore(Compass): replaced flex layout in CompassMainHeader#7984

Merged
mcoker merged 7 commits into
patternfly:mainfrom
thatblindgeye:iss7969
Nov 10, 2025
Merged

chore(Compass): replaced flex layout in CompassMainHeader#7984
mcoker merged 7 commits into
patternfly:mainfrom
thatblindgeye:iss7969

Conversation

@thatblindgeye

Copy link
Copy Markdown
Contributor

Closes #7969

@patternfly-build

patternfly-build commented Nov 10, 2025

Copy link
Copy Markdown
Collaborator

}

.#{$compass}__main-header {
& .#{$compass}__panel {

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.

The & is redundant when using a nested element like this, though you'd want to target the direct descendent in case for some weird reason there were nested panel elements

Suggested change
& .#{$compass}__panel {
> .#{$compass}__panel {

.#{$compass}__main-header {
& .#{$compass}__panel {
display: flex;
flex-wrap: wrap;

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.

I'm not sure if these should wrap. Typically with these types of elements, we don't wrap by default. It's up to the user to manage the toolbar size so it leaves room for the title. For card, we have a .pf-m-wrap modifier for the header. I looked at the existing demos and the flex layout wraps, but IMO that's because it's the default for the flex layout, not an intentional choice (not by me anyways).

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.

Can remove, this was just one of the properties from the Flex layout components I ported over to this.

display: flex;
flex-wrap: wrap;
gap: var(--#{$compass}__main-header--RowGap) var(--#{$compass}__main-header--ColumnGap);
align-items: center;

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.

If they don't wrap by default, we'd want to take this off and leave things top-aligned or baseline aligned or something like that, so that if the title text wraps, it wraps like the card. And because the actions should be taller than the title, the title would probably need align-self: center

Image


.#{$compass}__main-header-title {
flex-grow: 1;
max-width: 100%;

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.

Curious why you needed max-width: 100%? Sometimes the contents of flex items overflow their container, but it's most often due to min-width: min-content as the default for a flex item, and you'd disable that with min-width: 0;.

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.

Similar to above, was one of the things applied with the Flex layout components being used that I ported to this. Wasn't sure exactly what properties we'd want on these new classes after getting rid of those Flex components

}

.#{$compass}__main-header-toolbar {
max-width: 100%;

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.

same comment about max-width: 100% as on the block above.

@mcoker mcoker 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.

🚀

Comment on lines +102 to +104
.#{$compass}__main-header-title {
flex-grow: 1;
}

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.

You can take this out of the nesting, it should only be used in this context. The lower the specificity the better in general.

@mcoker mcoker merged commit 7ea472e into patternfly:main Nov 10, 2025
4 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.5.0-prerelease.22 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compass - update CompassMainHeader to support title and toolbar elements

3 participants