-
Notifications
You must be signed in to change notification settings - Fork 29
add OpenShift LogSnippet #105
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
Conversation
borderLeft: '2px solid var(--pf-v5-global--danger-color--100)', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
marginLeft: '6px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ther are PF CSS variables for margins/paddings we should be using
const useStyles = createUseStyles({ | ||
logSnippet: { | ||
borderLeft: '2px solid var(--pf-v5-global--danger-color--100)', | ||
display: 'flex', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a PF layout we should be able to use rather than hardcoding layouts into the CSS. https://www.patternfly.org/layouts/flex
import { createUseStyles } from 'react-jss' | ||
|
||
const useStyles = createUseStyles({ | ||
logSnippet: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use clsx with this. Is there a reason we aren't here? I think we should use a layout instead of the div and p below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought clsx was just for conditional rendering
}, | ||
}); | ||
|
||
interface LogSnippetProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be exported.
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.logSnippet}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a PF layout you can use instead of these div and paragraphs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replaced the div with the flex layout. I'm not sure what to do about the paragraph. Is there something you have in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@InsaneZein we could use https://www.patternfly.org/components/text
@InsaneZein Looks like linting is failing. |
subsection: Component groups | ||
# Sidenav secondary level section | ||
# should be the same for all markdown files | ||
id: LogSnippet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id: LogSnippet | |
id: Log snippet |
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`; | ||
|
||
return <> | ||
<LogSnippet message='A log snippet' logSnippet={code} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could maybe adjust the label to make it more explicit what is its purpose
<LogSnippet message='A log snippet' logSnippet={code} /> | |
<LogSnippet message='Failure - check logs for details' logSnippet={code} /> |
|
||
const useStyles = createUseStyles({ | ||
logSnippet: { | ||
borderLeft: '2px solid var(--pf-v5-global--danger-color--100)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The red border should be probably optional or at least overridable with custom class. We may also need a different variant than danger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolethoen please, what do you think about the border vs PF habits? Do we want to have it visible by default with an option to hide and select color variant? Or maybe do not show it and if OpenShift wants it, they can pass a custom className? Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few ways it could be done.
An additional prop could be used - either a flag like isBorderLeft
, or an enum like borderLeftVariant='red|<other options>
.
we could even expose a customBorderLeftColor
which could override this style if we want red to be the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably vote for borderLeftVariant
with colors and "hidden" option. Thoughts? @InsaneZein @nicolethoen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm good with that. I'll get to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolethoen is there a subset of acceptable colors? I just went ahead and added 'red' | 'green' | 'blue' | 'cyan' | 'gold' | 'orange' | 'purple'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked with @fhlavac we're thinking of just passing in "danger", "success", "info", "warning", or "hidden" so the variants would be --pf-v5-global--danger-color--100 --pf-v5-global--success-color--100 --pf-v5-global--info-color--100 --pf-v5-global--warning-color--100
export interface LogSnippetProps { | ||
/** log snippet or code you would like to display */ | ||
logSnippet?: string; | ||
/** message to appear above the log snippet */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** message to appear above the log snippet */ | |
/** Message to appear above the log snippet */ |
}); | ||
|
||
export interface LogSnippetProps { | ||
/** log snippet or code you would like to display */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** log snippet or code you would like to display */ | |
/** Log snippet or code to be displayed */ |
borderLeft: '2px solid var(--pf-v5-global--danger-color--100)', | ||
marginLeft: 'var(--pf-v5-global--spacer--sm)', | ||
padding: 'var(--pf-v5-global--spacer--sm) 0 var(--pf-v5-global--spacer--sm) var(--pf-v5-global--spacer--sm)', | ||
backgroundColor: 'white' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may want to use PF variable as well
backgroundColor: 'white' | ||
}, | ||
statusMessage: { | ||
marginBottom: '10px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be replaced by PF variable depending on UX suggestions
@InsaneZein looks good, just some styling/cleanup notes. Thank you 🎉 |
...module/patternfly-docs/content/extensions/component-groups/examples/LogSnippet/LogSnippet.md
Show resolved
Hide resolved
/** Log snippet or code to be displayed */ | ||
logSnippet?: string; | ||
/** Message to appear above the log snippet */ | ||
message: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking if it wouldn't be better to make the message a ReactNode to be easier customizable. If string is passed, we can wrap it inside Text as we do now
const classes = useStyles(); | ||
|
||
return ( | ||
<Flex direction={{ default: 'column' }} className={classes.logSnippet}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@InsaneZein what do you think about extending FlexProps in the LogSnippetProps to make this more customizable?
|
||
const useStyles = createUseStyles({ | ||
logSnippet: { | ||
borderLeft: '2px solid var(--pf-v5-global--danger-color--100)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, we could use the PF variable for the border width - --pf-v5-global--BorderWidth--md
…nto add-logsnippet
96c265e
to
9c8dbf8
Compare
…t-groups into add-logsnippet
@InsaneZein If you rebase this with main it should now pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…nto add-logsnippet
logSnippet: { | ||
marginLeft: 'var(--pf-v5-global--spacer--sm)', | ||
padding: 'var(--pf-v5-global--spacer--sm) 0 var(--pf-v5-global--spacer--sm) var(--pf-v5-global--spacer--sm)', | ||
backgroundColor: 'var(--pf-v5-global--palette--black-100)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd advocate that we use a more meaningful variable here: maybe: --pf-v5-global--BackgroundColor--200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@InsaneZein one last thing - we seem to be missing feat(xx): prefix in at least one commit message to trigger the release. Can you please add it? |
981449f
to
ea38872
Compare
🎉 This PR is included in version 5.1.0-prerelease.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
closes #99