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

[UI]: add a version tag to CatalogCard component #691

Closed
wants to merge 7 commits into from
17 changes: 16 additions & 1 deletion src/custom/CatalogCard/CatalogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,21 @@ type CatalogCardProps = {
cardWidth: string;
cardStyles: React.CSSProperties;
type: string;
version?: string;
};

export const VersionTag = styled('div')(({ theme }) => ({
position: 'absolute',
top: '40px',
right: '8px',
backgroundColor: theme.palette.primary.main,
Copy link
Member

Choose a reason for hiding this comment

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

use color from palette @SAHU-01

color: theme.palette.primary.contrastText,
padding: '2px 6px',
borderRadius: '4px',
fontSize: '0.75rem',
fontWeight: 'bold'
}));

export const ClassToIconMap = {
community: <CommunityClassIcon width="16px" height="12px" />,
official: <OfficialClassIcon width="16px" height="12px" />,
Expand All @@ -63,7 +76,8 @@ const CatalogCard: React.FC<CatalogCardProps> = ({
cardHeight,
cardWidth,
cardStyles,
cardLink
cardLink,
version
}) => {
const outerStyles = {
height: cardHeight,
Expand All @@ -75,6 +89,7 @@ const CatalogCard: React.FC<CatalogCardProps> = ({
<DesignCard outerStyles={outerStyles}>
<DesignInnerCard className="innerCard">
<ClassWrap catalogClassName={pattern?.catalog_data?.content_class} />
{version && <VersionTag>v: {version}</VersionTag>}
<DesignType>{patternType}</DesignType>
<DesignDetailsDiv>
<DesignName
Expand Down
Loading