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

add truncatedLength as an option to card body #225

Merged
merged 5 commits into from
May 10, 2024

Conversation

labradford
Copy link
Collaborator

Adds ability to pass in the truncated text length so the showmore toggle only shows according to what you want. Default is set to 300 still.

@@ -26,13 +26,13 @@ const CardBody = ({ buttonLink, buttonProps, item, markdownDescriptionTruncated,
</Card.Title>
{orientation === 'horizontal' ? (
<>
<div className='fw-light mh-300 overflow-auto mt-3'>
<div className='fw-light mh-300 overflow-auto mt-3 testing'>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div className='fw-light mh-300 overflow-auto mt-3 testing'>
<div className='fw-light mh-300 overflow-auto mt-3'>

@@ -4,7 +4,7 @@ import { Button, Card, Collapse } from 'react-bootstrap'
import NextLink from '../../components/NextLink/NextLink'
import LinkedButton from '../LinkedButton/LinkedButton'

const CardBody = ({ buttonLink, buttonProps, item, markdownDescriptionTruncated, markdownDescriptionExtended, orientation, titleLink, withButtonLink, withTitleLink }) => {
const CardBody = ({ buttonLink, buttonProps, item, markdownDescriptionTruncated, markdownDescriptionExtended, truncatedLength, orientation, titleLink, withButtonLink, withTitleLink }) => {
Copy link
Member

Choose a reason for hiding this comment

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

what do you think about changing this variable name to truncateAt? feels a little more semantic.

also, can you move this to after "titleLink"? the variables are alphabetized.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Summer called it cutOffIndex. Do you think it makes sense to use that?

Copy link
Member

Choose a reason for hiding this comment

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

I feel like truncateAt is even more semantic than cutOffIndex...but I'm fine with either.

@alishaevn alishaevn merged commit f15906f into main May 10, 2024
2 checks passed
@alishaevn alishaevn deleted the iphenovista71-add-truncated-length-to-cardbody branch May 10, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants