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: add styles props to support Badge wrapper style #48169

Open
wants to merge 7 commits into
base: feature
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion components/badge/Ribbon.tsx
Expand Up @@ -13,6 +13,9 @@ export interface RibbonProps {
className?: string;
prefixCls?: string;
style?: React.CSSProperties; // style of ribbon element, not the wrapper
styles?: {
body?: React.CSSProperties;
};
text?: React.ReactNode;
color?: LiteralUnion<PresetColorType>;
children?: React.ReactNode;
Expand All @@ -25,6 +28,7 @@ const Ribbon: React.FC<RibbonProps> = (props) => {
className,
prefixCls: customizePrefixCls,
style,
styles,
color,
children,
text,
Expand Down Expand Up @@ -55,7 +59,10 @@ const Ribbon: React.FC<RibbonProps> = (props) => {
cornerColorStyle.color = color;
}
return wrapCSSVar(
<div className={classNames(wrapperCls, rootClassName, hashId, cssVarCls)}>
<div
className={classNames(wrapperCls, rootClassName, hashId, cssVarCls)}
style={{ ...styles?.body }}
CooperHash marked this conversation as resolved.
Show resolved Hide resolved
>
{children}
<div className={classNames(ribbonCls, hashId)} style={{ ...colorStyle, ...style }}>
<span className={`${prefixCls}-text`}>{text}</span>
Expand Down