- {description?.length > 300 && (
+ {description?.length > truncateAt && (
@@ -86,6 +86,7 @@ CardBody.propTypes = {
PropTypes.string,
PropTypes.elementType,
]),
+ truncateAt: PropTypes.number,
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
titleLink: PropTypes.string,
withButtonLink: PropTypes.bool,
@@ -100,6 +101,7 @@ CardBody.defaultProps = {
},
markdownDescriptionTruncated: '',
markdownDescriptionExtended: '',
+ truncateAt: 300,
orientation: 'vertical',
titleLink: '',
withButtonLink: false,
diff --git a/src/compounds/Item/Item.jsx b/src/compounds/Item/Item.jsx
index 65ee165..0546046 100644
--- a/src/compounds/Item/Item.jsx
+++ b/src/compounds/Item/Item.jsx
@@ -8,8 +8,8 @@ import ItemLoading from './ItemLoading'
import NextLink from '../../components/NextLink/NextLink'
import './item.scss'
-const Item = ({ buttonLink, buttonProps, markdownDescriptionTruncated, markdownDescriptionExtended, href, isLoading, item, orientation, titleLink, withButtonLink,
- withTitleLink, width }) => {
+const Item = ({ buttonLink, buttonProps, markdownDescriptionTruncated, markdownDescriptionExtended, href, isLoading, item, orientation, titleLink, truncateAt,
+ withButtonLink, withTitleLink, width }) => {
if (isLoading) {
return (
<>
@@ -49,6 +49,7 @@ const Item = ({ buttonLink, buttonProps, markdownDescriptionTruncated, markdownD
markdownDescriptionExtended={markdownDescriptionExtended}
orientation={orientation}
titleLink={link}
+ truncateAt={truncateAt}
withButtonLink={withButtonLink}
withTitleLink={withTitleLink}
/>
@@ -69,6 +70,7 @@ const Item = ({ buttonLink, buttonProps, markdownDescriptionTruncated, markdownD
item={item}
markdownDescriptionTruncated={markdownDescriptionTruncated}
markdownDescriptionExtended={markdownDescriptionExtended}
+ truncateAt={truncateAt}
orientation={orientation}
titleLink={link}
withButtonLink={withButtonLink}
diff --git a/src/compounds/Item/Item.stories.jsx b/src/compounds/Item/Item.stories.jsx
index 53cb3a9..436252c 100644
--- a/src/compounds/Item/Item.stories.jsx
+++ b/src/compounds/Item/Item.stories.jsx
@@ -25,14 +25,42 @@ Default.args = {
},
name: 'Microbiological Sterility Testing',
slug: 'microbiological-sterility-testing',
+ snippet: ''
},
titleLink: '/',
orientation: 'vertical',
style: {},
withButtonLink: false,
withTitleLink: false,
+ markdownDescriptionTruncated: null,
+ markdownDescriptionExtended: null
+}
+
+export const Horizontal = Template.bind({})
+Horizontal.args = {
+ buttonLink: '/',
+ buttonProps: {
+ backgroundColor: '#A9A9A9',
+ label: 'Request this item',
+ },
+ item: {
+ description: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.',
+ id: 1,
+ img: {
+ src: item,
+ alt: 'Several rows of test tubes with a liquid being put into one.',
+ },
+ name: 'Microbiological Sterility Testing',
+ slug: 'microbiological-sterility-testing',
+ },
+ titleLink: '/',
+ orientation: 'horizontal',
+ style: {},
+ withButtonLink: false,
+ withTitleLink: false,
markdownDescriptionTruncated: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.',
- markdownDescriptionExtended: ' Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.'
+ markdownDescriptionExtended: 'Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.',
+ truncateAt: 300
}
export const isLoading = Template.bind({})