Skip to content

Commit

Permalink
feat: fix recommendations card subtitle (openedx#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
zainab-amir authored and snglth committed Jan 9, 2024
1 parent 368a448 commit 746530d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/recommendations/ProductCard/BaseCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const BaseCard = ({
/>
<Card.Header
className="mt-2"
title={truncateText(title)}
subtitle={truncateText(subtitle)}
title={truncateText(title, 50)}
subtitle={truncateText(subtitle, 30)}
/>
<Card.Section className="d-flex">
<div className="product-badge">
Expand Down
4 changes: 3 additions & 1 deletion src/recommendations/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export const getVariant = (productType) => (

export const createCodeFriendlyProduct = (type) => type?.replace(/\s+/g, '-').replace(/'/g, '').toLowerCase();

export const truncateText = (input) => (input?.length > 50 ? `${input.substring(0, 50)}...` : input);
export const truncateText = (input, textLength) => (
input?.length > textLength ? `${input.substring(0, textLength)}...` : input
);

export const filterLocationRestriction = (products, countryCode) => products.filter((product) => {
if (product.locationRestriction) {
Expand Down

0 comments on commit 746530d

Please sign in to comment.