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

Allow sending action which is rendered next to tile title #283

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

karelhala
Copy link
Contributor

@karelhala karelhala commented Feb 16, 2024

Description

In our quickstarts we need to render a bookmark button that bookmarks the quickstart. In order to render said button we need to send a button with this icon to the quickstart. This PR surfaces this trough quickStartTile to the header.

Screenshot

Screenshot from 2024-02-16 15-43-02

Copy link

netlify bot commented Feb 16, 2024

Deploy Preview for quickstarts ready!

Name Link
🔨 Latest commit 7956278
🔍 Latest deploy log https://app.netlify.com/sites/quickstarts/deploys/65de0ac3e418d00008c95d19
😎 Deploy Preview https://deploy-preview-283--quickstarts.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@dlabaj dlabaj left a comment

Choose a reason for hiding this comment

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

Overall looks good. Just wondering if we would be better off building the bookmark button internally instead of allowing some to make it themself. There where some strange layout issues if they didn't build it correctly. Let me know.

<Title headingLevel="h3" data-test="title" id={quickStartId}>
<QuickStartMarkdownView content={name} />
</Title>
{action}
Copy link
Contributor

Choose a reason for hiding this comment

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

What's your thoughts on creating the bookmark internally? I was able to create some strange results passing in the button component not set to a link. The alignment also looked good in some cases but if the title got to large it looked to low. I would think we would want it to stick to the top. Let me know your thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about it from the start as well, but I was not that big of a fan of it. Good point on style misalignment, how about we change this to an object with actionIcon, onActionClick and actionAriaLabel. Right now we want to show plain button. If someone would want to display a dropdown in here, with these 3 items they should be able to do that (by using dropdown menu and attaching it to the right place) should there be such need in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

That works for me. Maybe make one of the cards in the demo doc with how to implement it. So people would know.

@@ -17,13 +17,15 @@ interface QuickStartTileProps {
status: QuickStartStatus;
isActive: boolean;
onClick?: () => void;
action?: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if should just allow a callback function instead and build the bookmark button ourself inside. I got some strange results passing in the incorrect type of button.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we are not going to build it internally, we need documentation for how to use these props and this component. At the very least, we should add comments to each of these QuickStartTileProps. Eventually, those props can be used in the quickstarts docs on PF.org

I'm noticing that there is no example in the PF docs for how to build a CustomCatalog as is done in the demo app. ideally, we'd have an example that would also expose the APIs for all these components consumers could be using. That would need to be done in a follow up issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this approach! I've changed it to be a button with predefined config. For power users I've also allowed passing buttonProps should they need to tinker with the button (for example changing the hover state etc.).

@nicolethoen good point on adding this to a CustomCatalog, I've added another section with same content as is rest and added the bookmark toggle.

@@ -17,13 +17,15 @@ interface QuickStartTileProps {
status: QuickStartStatus;
isActive: boolean;
onClick?: () => void;
action?: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are not going to build it internally, we need documentation for how to use these props and this component. At the very least, we should add comments to each of these QuickStartTileProps. Eventually, those props can be used in the quickstarts docs on PF.org

I'm noticing that there is no example in the PF docs for how to build a CustomCatalog as is done in the demo app. ideally, we'd have an example that would also expose the APIs for all these components consumers could be using. That would need to be done in a follow up issue.

@@ -9,4 +9,9 @@
& .pf-v5-c-badge:not(:last-of-type) {
margin-right: var(--pf-v5-global--spacer--sm);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm so conditioned to avoid writing custom CSS.

So my instinct here is to say that I think you could replace this div.pfext-quick-start-title-header__display-name with :

<Flex  justifyContent={{ default: 'justifyContentCenter' }}>
       <Title headingLevel="h3" data-test="title" id={quickStartId}>
          <QuickStartMarkdownView content={name} />
        </Title>
        {action}
</Flex>

And you might opt to wrap the children in a FlexItem but i don't think that'll be necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

agree. i'm just use to custom css breaking i try to avoid it.

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm still concerned about the action though. since i think you can't just really put anything there and someone may try to do that.

@karelhala karelhala force-pushed the add-tile-action branch 3 times, most recently from f0fce4f to 30e83ec Compare February 19, 2024 08:22
Copy link
Contributor

@dlabaj dlabaj left a comment

Choose a reason for hiding this comment

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

LGTM with the new changes. Seems to be failing an A11y test if you need help with that let me know.

@karelhala
Copy link
Contributor Author

@dlabaj thank you! I might need some help with the duplicate IDs, they look like are not par of my changes. However I had to change how ID is generated for tile, it used to take just name. Now it consumes ID as well and if that is present it uses this ID. I then changed how quickstart is activated and use just the name of quickstart (as ID can be different than name).

@nicolethoen
Copy link
Contributor

Okay - i've discovered that the duplicate id in these docs is description-alert-note
I'm about to try and fix it, but if knowing that means someone knows the quick fix, then let me know.

@nicolethoen
Copy link
Contributor

CustomCatalog is looping over the same list twice of allQuickStarts to build the Bookmarkable and the Instructional lists of Quickstart tiles.

the hardcoded id on line 8 of alert-note-prereq/README.adoc is what is being used twice in the docs

@karelhala
Copy link
Contributor Author

@nicolethoen yeah I wanted to duplicate the quickstarts as an example of bookmarked items. I am starting to think about removing the custom catalog changes and let PF team to do proper examples 😞

@dlabaj
Copy link
Contributor

dlabaj commented Feb 27, 2024

@karelhala We decided to remove the asciidoc examples. The only product that uses it was kafka but that product is no longer available. While the feature to use the asciidoc is still there we are going to encourage people to use markdown instead.

@dlabaj
Copy link
Contributor

dlabaj commented Feb 27, 2024

This issue is causing the Percy test to fail. patternfly/patternfly#6352. We will need a fix from core. It only affects chrome and works in firefox. I wouldn't hold up this merge to quickstart over the failing Percy test. Let me know what you think @jessiehuff @nicolethoen

Copy link
Contributor

@dlabaj dlabaj left a comment

Choose a reason for hiding this comment

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

LGTM Tested it in firefox and it works.

@dlabaj dlabaj merged commit 0babc9c into patternfly:main Feb 28, 2024
9 of 10 checks passed
Copy link

github-actions bot commented Mar 7, 2024

🎉 This PR is included in version 5.2.0-prerelease.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

dlabaj added a commit to dlabaj/patternfly-quickstarts that referenced this pull request Jun 27, 2024
…#283)

* Allow sending action which is rendered next to tile title

* Change action to predefined button and add an example

* Fix failing A11 tests

* Use meta ID if present for card IDs

* fix(ascii): Remove ascii doc examples.

* fix(lint): Fixed linting issue.

---------

Co-authored-by: Donald Labaj <[email protected]>
dlabaj added a commit to dlabaj/patternfly-quickstarts that referenced this pull request Jul 1, 2024
…#283)

* Allow sending action which is rendered next to tile title

* Change action to predefined button and add an example

* Fix failing A11 tests

* Use meta ID if present for card IDs

* fix(ascii): Remove ascii doc examples.

* fix(lint): Fixed linting issue.

---------

Co-authored-by: Donald Labaj <[email protected]>
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.

3 participants