Skip to content

Conversation

@fhlavac
Copy link
Contributor

@fhlavac fhlavac commented Feb 7, 2024

JIRA link: RHCLOUD-30296
closes #93

  • added Shortcut component
  • added ShortcutGrid component
  • created documentation pages & tests

image

Copy link
Collaborator

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

Few comments. I couldn't get the documentation examples to work as described. Maybe I'm doing something wrong. :-)

</span>
);}

// .ocs-shortcut {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should remove the dead code.

package.json Outdated
"rimraf": "^2.6.2",
"serve": "^14.1.2",
"ts-jest": "29.0.3",
"user-agent-data-types": "^0.4.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason we need this?

return (
<span className={clsx("pf-v5-u-mr-sm", classes.command)}>
<kbd>{children}</kbd>
{/* <Chip className="pf-v5-u-mr-sm" isReadOnly>{children}</Chip> */}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should remove dead code.

source: react
# If you use typescript, the name of the interface to display props for
# These are found through the sourceProps function provided in patternfly-docs.source.js
propComponents: ['Shortcut']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Documentation is missing props you need to export the ShortcutProps and pass them in to the function component specifying the prop types.

import { createUseStyles } from 'react-jss';
import { clsx } from 'clsx';

interface ShortcutProps {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add documentation comments to the shortcut props

@dlabaj
Copy link
Collaborator

dlabaj commented Feb 8, 2024

looks like theres a linting error.

@fhlavac
Copy link
Contributor Author

fhlavac commented Feb 9, 2024

Sorry, it's just a draft. Forgot to mark it properly

@fhlavac fhlavac marked this pull request as draft February 9, 2024 07:10
@fhlavac fhlavac marked this pull request as ready for review February 13, 2024 16:29
@fhlavac
Copy link
Contributor Author

fhlavac commented Feb 13, 2024

@nicolethoen @jessiehuff @dlabaj
tried to merge the implementations from PF CodeEditor and OpenShift, please let me know if anything should be changed. Thank you! 🙂


return (
<>
<span className={clsx({ 'pf-v5-u-mr-lg': description, className })}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use the pf-v5-u classes in component groups frequently? the styles for the utility classes are not bundled with the standard patternfly.css. It'll require the consumer importing addons.css additionally. If we use those classes frequently, that's fine - but if we can avoid using them by default, that might result in fewer css imports needed by consumers.

Copy link
Contributor Author

@fhlavac fhlavac Feb 14, 2024

Choose a reason for hiding this comment

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

@nicolethoen for now we have about 20 occurrences in other components. We can replace them with classes using PF variables. It's probably a better practice, what do you think?

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 it'd agree - there may be times where a PF layout component or modifier class might already exist. It's a little bit case by case, but we can seek those out and update them overtime.


const useStyles = createUseStyles({
shortcutItem: {
textAlign: 'right',
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like something we could avoid using if we use a PF layout or modifier class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolethoen is it possible to set the alignment somehow for the grid itself or do I need any other layout?
I see only modifier class for flex "pf-m-align-right" or the util class "pf-v5-u-text-align-right" which we probably don't want to use ^^

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 asking our CSS devs

Copy link
Contributor

Choose a reason for hiding this comment

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

it seems the writing the css style out here is probably the best 👍🏻

@fhlavac
Copy link
Contributor Author

fhlavac commented Feb 14, 2024

@nicolethoen I can also see the a11y error saying violations: duplicate-id-active for ShortcutGrid. I cannot find the issue in the code. Is it also related to data-test-id? In one of the examples we have two same keys present so a duplicity may occur, but not sure if that's the thing. Locally the a11y scripts ends with Failed to crawl /extensions/component-groups/battery: net::ERR_CONNECTION_REFUSED for each of the components - not sure how to run it properly. Thank you 🙂

@nicolethoen
Copy link
Contributor

i believe it’s mad that the example title Shortcut is the same as the Props table ShortCut because it means that there are two links on the page with the same name. Maybe update the shortcut example name and the error will go away?

@dlabaj dlabaj merged commit 8029afb into patternfly:main Feb 15, 2024
@github-actions
Copy link

🎉 This PR is included in version 5.1.0-prerelease.6 🎉

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.

Migrate Shortcut

3 participants