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(app-layout): add pageinfosection component [KHCP-14578] #1888

Merged
merged 7 commits into from
Jan 10, 2025

Conversation

portikM
Copy link
Member

@portikM portikM commented Jan 10, 2025

Summary

Addresses: https://konghq.atlassian.net/browse/KHCP-14578

Adds CollapsibleSection component exported by app-layout package

@portikM portikM self-assigned this Jan 10, 2025
@portikM portikM requested review from adamdehaven, jillztom and a team as code owners January 10, 2025 15:46
Copy link
Member

@adamdehaven adamdehaven left a comment

Choose a reason for hiding this comment

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

suggestion: can you add this to the appropriate README documentation in the package?

Comment on lines 14 to 19
<div
v-if="title"
class="collapsible-section-title"
>
{{ title }}
</div>
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: should this be an actual header tag? e.g. h3

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a titleTag prop

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think of having a slot to control this instead of multiple props? Then I can just <template #title><h3 id="bookmarkable-h3">{{ title }}</h3></template>

Copy link
Member

Choose a reason for hiding this comment

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

It is slottable <slot name="header">

Copy link
Contributor

Choose a reason for hiding this comment

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

There's already a header slot for this. It wraps only the title and description.

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR was merged early by mistake (I forgot to disable auto-merge). If there is anything to follow up on, please drop comments on #1890

Copy link
Collaborator

@johncowen johncowen Jan 10, 2025

Choose a reason for hiding this comment

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

No prob! Umm did you have any thoughts on the props vs slots thing in relation to #1888 (comment) or shall I move it to the other PR? FYI: Its totally fine to say, "I hear your comment, just we don't want to get into it atm", we can discuss another time also.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't quite understand what the ask is in that comment.. if you're suggesting we add slot for description then I think it's a bit of an overkill at this stage? We don't really have use-cases for it yet and if one-off cases start appearing header prop and some custom CSS can handle that. If that becomes a common occurrence then I think it's worth adding a slot for that.

Copy link
Member

Choose a reason for hiding this comment

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

Here's my remaining question from this thread:

is there a use-case for slotting the header in the first place? The whole point of the component is to allow for a consistent UI across apps, so if we can remove slots where not needed, that would be ideal TBH

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose this is turning into a more general props vs slots comment, so I guess I'm asking whether we should generally default to using slots for these sorts of things instead of props because of the difficulties consumers have when they are just given props to work with. I suppose maybe depends if we are making these components to make the our lives easier or making these components to make consumers lives easier?

I guess theres maybe a lot of opinion here, so happy to finish this up and resolve this convo if nobody has any more to add?

@portikM
Copy link
Member Author

portikM commented Jan 10, 2025

suggestion: can you add this to the appropriate README documentation in the package?

Done

@portikM portikM requested a review from adamdehaven January 10, 2025 16:51
Copy link
Contributor

@vaibhavrajsingh2001 vaibhavrajsingh2001 left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment about the naming

Copy link
Contributor

Choose a reason for hiding this comment

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

Having collapsible in the component name might be misrepresentation since the section can be non-collapsible too, so we can end up with a non-collapsible CollapsibleSection component.
How about PageSection, similar to PageHeader component we already have.

Copy link
Member Author

Choose a reason for hiding this comment

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

Valid point but PageSection doesn't suggest that it can be collapsible, engineers would have to know it is from previous experience in order to know to use this component when they need collapsible section.. not sure what's the right approach here. @adamdehaven thought?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great point 👏

Copy link
Member

Choose a reason for hiding this comment

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

How about something like PageConfigSection or PageInfoSection; something that conveys the use case?

PageSection is a bit too vague IMO.

Knowing that it can be collapsible is really just a documentation issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to PageInfoSection

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about KSection? Come to think of it how come this isn't being added to kongponents? Feels like it should live over there?

Copy link
Member

@adamdehaven adamdehaven Jan 10, 2025

Choose a reason for hiding this comment

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

Just noticed we typically prefix with App* in this repo. AppPageConfigSection maybe?

Copy link
Member

Choose a reason for hiding this comment

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

How about KSection? Come to think of it how come this isn't being added to kongponents? Feels like it should live over there?

This is Konnect specific and will likely change over time.

Copy link
Member Author

@portikM portikM Jan 10, 2025

Choose a reason for hiding this comment

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

Just noticed we typically prefix with App* in this repo. AppPageConfigSection maybe?

Don't want to use the word config so it doesn't get mixed up with EntityConfigCard but AppPageInfoSection sounds good to me.

Copy link
Member Author

@portikM portikM Jan 10, 2025

Choose a reason for hiding this comment

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

This PR was merged early by mistake (I forgot to disable auto-merge). If there is anything to follow up on, please drop comments on #1890

@portikM portikM enabled auto-merge (squash) January 10, 2025 16:56
@johncowen
Copy link
Collaborator

How would I add an icon here?

Screenshot 2025-01-10 at 16 53 49

Do we support collapsible sections with icons?

Maybe this is all TBD, but lemme know!

@vaibhavrajsingh2001
Copy link
Contributor

How would I add an icon here?

Screenshot 2025-01-10 at 16 53 49

Do we support collapsible sections with icons?

Maybe this is all TBD, but lemme know!

For the image you shared, the icon would go in the actions slot and it'll be a non-collapsible section.
If an icon is supposed to be there then it shouldn't be a collapsible section, because where would the chevron go.

@portikM portikM changed the title fix(app-layout): add collapsiblesection component [KHCP-14578] fix(app-layout): add pageinfosection component [KHCP-14578] Jan 10, 2025
@johncowen
Copy link
Collaborator

For the image you shared, the icon would go in the actions slot and it'll be a non-collapsible section.

Ah missed that, thanks!

@portikM
Copy link
Member Author

portikM commented Jan 10, 2025

How would I add an icon here?
Screenshot 2025-01-10 at 16 53 49
Do we support collapsible sections with icons?
Maybe this is all TBD, but lemme know!

For the image you shared, the icon would go in the actions slot and it'll be a non-collapsible section. If an icon is supposed to be there then it shouldn't be a collapsible section, because where would the chevron go.

Just to add to this point: if the section was collapsible but didn't have a chevron, there would be no visual indication to user that it is collapsible. That's why we need the chevron there when it is collapsible.

@portikM portikM merged commit 977c718 into main Jan 10, 2025
8 checks passed
@portikM portikM deleted the fix/khcp-14578-collapsible-section-component branch January 10, 2025 17:31
portikM added a commit that referenced this pull request Jan 10, 2025
@@ -0,0 +1,74 @@
# PageInfoSection.vue
Copy link
Member

Choose a reason for hiding this comment

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

You didn't update the docs for the naming, etc.

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.

4 participants