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

feat(jss): Updated to use JSS and migrate styles from patternfly's react styles #60

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

dlabaj
Copy link
Contributor

@dlabaj dlabaj commented Jul 19, 2024

Updated code to use JSS and remove the need to import the styles from react styles. A follow up PR will be sent out to remove the console styles from patternfly repo. This resolves issue #36 .

Note there is also support for corepack users added to this PR.

Click here to see documentation preview.

@dlabaj dlabaj requested a review from kmcfaul July 19, 2024 06:00
@dlabaj dlabaj linked an issue Jul 22, 2024 that may be closed by this pull request
Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

I wonder how many of these CSS overrides we could actually remove now on V6. if not removed, many will need to be updated in this PR or a follow up

display: 'grid',
gridTemplateAreas:
`'actions-main actions-extra' + 'main main'`,
rowGap: 'var(--pf-v6-global--spacer--md)'
Copy link
Contributor

Choose a reason for hiding this comment

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

These global variables will not exist in v6 - they are replaced with things that start with --pf-t-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

resize: 'none'
},
'.xterm .composition-view': {
background: '#000',
Copy link
Contributor

Choose a reason for hiding this comment

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

There are tokens that can be used in lieu of hard coded color values

},
consoleActionsVnc: {
gridArea: 'actions-extra',
display: 'flex',
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can use a flex layout here instead of all these flex related css overrides

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense we should add this. Created an issue for this so that we can add this without slowing down the release as this will require some rework (#62).

},
consoleActionsVnc: {
gridArea: 'actions-extra',
display: 'flex',
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can use a flex layout here instead of all these flex related css overrides

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #62

Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

Not sure if it's just related to the above style issues but it does look like something is off with the styling in the example at least, i.e. the console loads in over the controls, and the controls look funky before the console loads.

image

image

@@ -135,9 +150,9 @@ export const AccessConsoles: React.FunctionComponent<AccessConsolesProps> = ({
}
});
return (
<div className={css(styles.console)}>
<div className={clsx(styles.console)}>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.console)}>
<div className={styles.console}>

I think there is no need to use clsx in such cases

}: SerialConsoleActionsProps) => {
const styles = useStyles();
return (
<div className={clsx(styles.consoleActionsSerial)}>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.consoleActionsSerial)}>
<div className={styles.consoleActionsSerial}>

@@ -130,6 +134,6 @@ export const XTerm: React.FunctionComponent<XTermProps> = ({

// ensure react never reuses this div by keying it with the terminal widget
// Workaround for xtermjs/xterm.js#3172
return <div ref={ref} className="pf-v6-c-console__xterm" role="list" onFocus={onFocusIn} onBlur={onFocusOut} />;
return <div ref={ref} className={clsx(styles['.xterm'])} role="list" onFocus={onFocusIn} onBlur={onFocusOut} />;
Copy link

Choose a reason for hiding this comment

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

Suggested change
return <div ref={ref} className={clsx(styles['.xterm'])} role="list" onFocus={onFocusIn} onBlur={onFocusOut} />;
return <div ref={ref} className={styles['.xterm']} role="list" onFocus={onFocusIn} onBlur={onFocusOut} />;

@@ -235,7 +248,7 @@ export const VncConsole: React.FunctionComponent<VncConsoleProps> = ({
return (
<>
{rightContent}
<div className={css(styles.consoleVnc)}>
<div className={clsx(styles.consoleVnc)}>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.consoleVnc)}>
<div className={styles.consoleVnc}>

@@ -34,7 +48,7 @@ export const VncActions: React.FunctionComponent<VncActionProps> = ({
setIsOpen(false);
};
const toolbar = (
<div className={css(styles.consoleActionsVnc)}>
<div className={clsx(styles.consoleActionsVnc)}>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.consoleActionsVnc)}>
<div className={styles.consoleActionsVnc}>

@@ -130,7 +134,7 @@ const SerialConsoleBase: React.FunctionComponent<SerialConsoleProps> = ({
textReset={textReset}
/>
)}
<div className={css(styles.consoleSerial)}>{terminal}</div>
<div className={clsx(styles.consoleSerial)}>{terminal}</div>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.consoleSerial)}>{terminal}</div>
<div className={styles.consoleSerial}>{terminal}</div>

}: DesktopViewerProps) => {
const styles = useStyles();
return (
<div className={clsx(styles.consoleDesktopViewer)}>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.consoleDesktopViewer)}>
<div className={styles.consoleDesktopViewer}>

{React.Children.toArray(children).length > 1 && (
<div className={css(styles.consoleActions)}>
<div className={clsx(styles.consoleActions)}>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<div className={clsx(styles.consoleActions)}>
<div className={styles.consoleActions}>

…jss. Also added corepack support for legacy yarn.
@dlabaj
Copy link
Contributor Author

dlabaj commented Jul 24, 2024

Not sure if it's just related to the above style issues but it does look like something is off with the styling in the example at least, i.e. the console loads in over the controls, and the controls look funky before the console loads.

image

image

Fixed and updated the code.


.xterm .composition-view {
/* TODO: Composition position got messed up somewhere */
background: #000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can colors in this file be updated to tokens rather than hardcoded hex values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Thanks nicole.

@dlabaj dlabaj merged commit 993717c into patternfly:v6 Jul 25, 2024
7 checks passed
Copy link

🎉 This PR is included in version 6.0.0-alpha.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 6.0.0-prerelease.1 🎉

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.

Move CSS from react-styles into react-console
4 participants