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

fix(card-ribbon): Add z-index value to ribbon and spread props to improve flexibility of component #88

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/pancake-uikit/src/components/Card/CardRibbon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface StyledCardRibbonProps extends CardRibbonProps {
}

const StyledCardRibbon = styled.div<Partial<StyledCardRibbonProps>>`
z-index: 1;
background-color: ${({ variantColor = "secondary", theme }) => theme.colors[variantColor]};
color: white;
margin: 0;
Expand Down Expand Up @@ -51,9 +52,9 @@ const StyledCardRibbon = styled.div<Partial<StyledCardRibbonProps>>`
}
`;

const CardRibbon: React.FC<CardRibbonProps> = ({ variantColor, text, ribbonPosition }) => {
const CardRibbon: React.FC<CardRibbonProps> = ({ variantColor, text, ribbonPosition, ...props }) => {
return (
<StyledCardRibbon variantColor={variantColor} ribbonPosition={ribbonPosition}>
<StyledCardRibbon variantColor={variantColor} ribbonPosition={ribbonPosition} {...props}>
<div title={text}>{text}</div>
</StyledCardRibbon>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/pancake-uikit/src/components/Card/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HTMLAttributes } from "react";
import { SpaceProps } from "styled-system";
import { Colors } from "../../theme/types";

export interface CardRibbonProps {
export interface CardRibbonProps extends SpaceProps, HTMLAttributes<HTMLDivElement> {
variantColor?: keyof Colors;
text: string;
ribbonPosition?: "right" | "left";
Expand Down