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(banner): add support for new styles in penta #9891

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

wise-king-sullyman
Copy link
Contributor

What: Closes #9856

Additional issues:

@wise-king-sullyman wise-king-sullyman linked an issue Dec 13, 2023 that may be closed by this pull request
Comment on lines +5 to +7
export type BannerColor = 'red' | 'orangered' | 'orange' | 'gold' | 'green' | 'cyan' | 'blue' | 'purple';

export type BannerStatus = 'success' | 'warning' | 'danger' | 'info' | 'custom';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exported union types so that consumers can import them if needed, I remember that being talked about at an office hours not long ago.

Comment on lines +25 to +35
interface StatusBanner extends BannerProps {
color?: never;
status?: BannerStatus;
}

export const Banner: React.FunctionComponent<BannerProps> = ({
interface NonStatusBanner extends BannerProps {
color?: BannerColor;
status?: never;
}

export const Banner: React.FunctionComponent<StatusBanner | NonStatusBanner> = ({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried this out as a way of preventing both color and status props at the type level, I'm not committed to it if we don't like it though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not entirely sure how I feel about this. It's definitely an improvement from what was attempted in 91d7907 (with the main issue being it didn't render props in the prop table correctly, whereas this PR does).

At the same time I'm almost wondering if it'd be better to just keep the variant prop, and makes its type BannerStatus | BannerColor?

Otherwise this looks good. If anything we could have a followup discussion about it since it's only going into the v6 branch so I wouldn't block over this going in now.

@patternfly-build
Copy link
Contributor

patternfly-build commented Dec 13, 2023

@wise-king-sullyman wise-king-sullyman requested review from a team, nicolethoen, kmcfaul, andrew-ronaldson, lboehling and srambach and removed request for a team December 14, 2023 16:57
return styles.modifiers[color];
}
};

Copy link
Contributor

Choose a reason for hiding this comment

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

not a big deal and maybe more of a preference thing, but as color and status are used exactly the same way, i think i'd just get rid of getStatusOrColorModifier and replace the call with (color || status) && styles.modifiers[color || status]

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

L🎄TM!

Copy link
Collaborator

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

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

LGTM. The palette colours may change in CSS a bit but that shouldn't impact the react work. Thanks @wise-king-sullyman

Comment on lines +25 to +35
interface StatusBanner extends BannerProps {
color?: never;
status?: BannerStatus;
}

export const Banner: React.FunctionComponent<BannerProps> = ({
interface NonStatusBanner extends BannerProps {
color?: BannerColor;
status?: never;
}

export const Banner: React.FunctionComponent<StatusBanner | NonStatusBanner> = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Not entirely sure how I feel about this. It's definitely an improvement from what was attempted in 91d7907 (with the main issue being it didn't render props in the prop table correctly, whereas this PR does).

At the same time I'm almost wondering if it'd be better to just keep the variant prop, and makes its type BannerStatus | BannerColor?

Otherwise this looks good. If anything we could have a followup discussion about it since it's only going into the v6 branch so I wouldn't block over this going in now.

Copy link
Member

@srambach srambach left a comment

Choose a reason for hiding this comment

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

Looks ok from the core side.

@nicolethoen nicolethoen merged commit 4313e3c into patternfly:v6 Dec 20, 2023
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-charts@8.0.0-alpha.5
  • @patternfly/react-code-editor@6.0.0-alpha.6
  • @patternfly/react-core@6.0.0-alpha.6
  • @patternfly/react-docs@7.0.0-alpha.6
  • @patternfly/react-icons@6.0.0-alpha.5
  • @patternfly/react-integration@6.0.0-alpha.4
  • demo-app-ts@5.1.1-alpha.5
  • @patternfly/react-styles@6.0.0-alpha.5
  • @patternfly/react-table@6.0.0-alpha.6
  • @patternfly/react-tokens@6.0.0-alpha.5
  • transformer-react-styles-esm-imports@1.0.1-alpha.1

Thanks for your contribution! 🎉

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.

Consume core updates: Banner
8 participants