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

Centralizing the CatalogCard component in sistent #688

Closed
3 tasks
SAHU-01 opened this issue Jul 23, 2024 · 1 comment
Closed
3 tasks

Centralizing the CatalogCard component in sistent #688

SAHU-01 opened this issue Jul 23, 2024 · 1 comment
Labels
kind/enhancement Improvement in current feature

Comments

@SAHU-01
Copy link
Contributor

SAHU-01 commented Jul 23, 2024

Current Behavior

The meshery-cloud is still using its own CatalogCard, this needs to be centralized to sistent to consolidate these components.

Desired Behavior

Enhance the Sistent component to avoid creation and usage of a separate CatalogCard in meshery-cloud

Implementation

  • Adding version property to CatalogCardProps
type CatalogCardProps = {
  // ... existing props
  version?: string;
};
  • Adding new styled component for the version tag
export const VersionTag = styled('div')(({ theme }) => ({
  position: 'absolute',
  top: '8px',
  right: '8px',
  backgroundColor: based on theme,
  color: based on theme,
  padding: '2px 6px',
  borderRadius: '4px',
  fontSize: '0.75rem',
  fontWeight: 'bold',
}));
  • Updating the CatalogCard component to include the version tag
const CatalogCard: React.FC<CatalogCardProps> = ({
  pattern,
  patternType,
  cardHeight,
  cardWidth,
  cardStyles,
  cardLink,
  version,
}) => {
//....existing code 
  <ClassWrap catalogClassName={pattern?.catalog_data?.content_class} />
   {version && <VersionTag>v{version}</VersionTag>}
   <DesignType>{patternType}</DesignType>

If the CatalogCard is used in a component that has a version it can then be passed like this:

<CatalogCard
  key={index}
  cardLink={`https://meshery.layer5.io/catalog/content/catalog/${item?.id}`}
  cardHeight="20rem"
  cardWidth="16rem"
  pattern={item}
  type="Catalog"
  patternType={item?.catalog_data?.type}
  version={item?.version} // Add this line if version tag is required
/>

Note: The above implementation is with reference to CatalogCard usage in CatalogGrid component of Layer5

Acceptance Tests

Mockups


Contributor Guide

@SAHU-01 SAHU-01 added the kind/enhancement Improvement in current feature label Jul 23, 2024
@SAHU-01
Copy link
Contributor Author

SAHU-01 commented Jul 23, 2024

@dottharun and @leecalcote please share your thoughts on the suggested implementation process. Based on your remarks I'll push commits and we can test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvement in current feature
Development

Successfully merging a pull request may close this issue.

1 participant