Skip to content

Commit 566cbfc

Browse files
committed
revert cardbody
1 parent 05f53b6 commit 566cbfc

File tree

1 file changed

+35
-50
lines changed

1 file changed

+35
-50
lines changed

src/compounds/Item/CardBody.jsx

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,52 @@ import { Card } from 'react-bootstrap'
44
import NextLink from '../../components/NextLink/NextLink'
55
import LinkedButton from '../LinkedButton/LinkedButton'
66

7-
const CardBody = ({
8-
buttonLink,
9-
buttonProps,
10-
item,
11-
orientation,
12-
titleLink,
13-
withButtonLink,
14-
withTitleLink,
15-
}) => {
16-
const { id, description, name } = item;
7+
const CardBody = ({ buttonLink, buttonProps, item,
8+
orientation, titleLink, withButtonLink, withTitleLink }) => {
9+
const { id, description, name } = item
1710

1811
return (
19-
<Card.Body className={withButtonLink && "d-flex flex-column"}>
20-
<div
21-
className={
22-
orientation === "horizontal"
23-
? "d-block d-md-flex align-items-center justify-content-between"
24-
: ""
25-
}
26-
>
27-
<div className={orientation === "horizontal" ? "me-2" : ""}>
28-
<Card.Title >
12+
<Card.Body className={withButtonLink && 'd-flex flex-column'}>
13+
<div className={orientation === 'horizontal' ? 'd-block d-md-flex align-items-center justify-content-between' : ''}>
14+
<div className={orientation === 'horizontal' ? 'me-2' : ''}>
15+
<Card.Title>
2916
{(withTitleLink) && (
3017
<NextLink
31-
text={name}
32-
path={{ pathname: titleLink, query: { id } }}
33-
addClass="text-decoration-none link-hover"
34-
/>)}
35-
{(!withTitleLink) && (
36-
name
18+
text={name}
19+
path={{ pathname: titleLink, query: { id } }}
20+
addClass='text-decoration-none link-hover'
21+
/>
3722
)}
38-
</Card.Title>
39-
{description && (
40-
<Card.Text className="fw-light">{description}</Card.Text>
23+
{(!withTitleLink) && (
24+
name
4125
)}
42-
</div>
43-
{withButtonLink && (
44-
<div
45-
className={orientation === "horizontal" ? "mt-3 mt-md-0" : "mt-3"}
46-
>
47-
<LinkedButton
48-
addClass={`item-button-${orientation} item-link mt-auto`}
49-
buttonProps={buttonProps}
50-
path={{ pathname: buttonLink, query: { id } }}
51-
/>
52-
</div>
26+
</Card.Title>
27+
{description && (
28+
<Card.Text className='fw-light'>
29+
{description}
30+
</Card.Text>
5331
)}
5432
</div>
55-
</Card.Body>
56-
);
57-
};
33+
{(withButtonLink) && (
34+
<div className={orientation === 'horizontal' ? 'mt-3 mt-md-0' : 'mt-3'}>
35+
<LinkedButton
36+
addClass={`item-button-${orientation} item-link mt-auto`}
37+
buttonProps={buttonProps}
38+
path={{ pathname: buttonLink, query: { id }}}
39+
/>
40+
</div>
41+
)}
42+
</div>
43+
</Card.Body>
44+
)
45+
}
5846

5947
CardBody.propTypes = {
6048
buttonLink: PropTypes.string,
6149
// currently overriding the label on a button from being required in this component,
6250
// because it shouldn't be if we are not rendering a button
6351
// refer to the comment below
64-
buttonProps: PropTypes.shape({
65-
...LinkedButton.propTypes.buttonProps,
66-
label: PropTypes.string,
67-
}),
52+
buttonProps: PropTypes.shape({ ...LinkedButton.propTypes.buttonProps, label: PropTypes.string }),
6853
// TODO(alishaevn): is there a way to set conditional proptypes without adding another package?
6954
// buttonProps: props => props.withButtonLink
7055
// ? PropTypes.shape(Button.propTypes)
@@ -83,7 +68,7 @@ CardBody.propTypes = {
8368
titleLink: PropTypes.string,
8469
withButtonLink: PropTypes.bool,
8570
withTitleLink: PropTypes.bool,
86-
};
71+
}
8772

8873
CardBody.defaultProps = {
8974
buttonLink: '',
@@ -95,6 +80,6 @@ CardBody.defaultProps = {
9580
titleLink: '',
9681
withButtonLink: false,
9782
withTitleLink: false,
98-
};
83+
}
9984

100-
export default CardBody;
85+
export default CardBody

0 commit comments

Comments
 (0)