@@ -4,67 +4,52 @@ import { Card } from 'react-bootstrap'
4
4
import NextLink from '../../components/NextLink/NextLink'
5
5
import LinkedButton from '../LinkedButton/LinkedButton'
6
6
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
17
10
18
11
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 >
29
16
{ ( withTitleLink ) && (
30
17
< 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
+ />
37
22
) }
38
- </ Card . Title >
39
- { description && (
40
- < Card . Text className = "fw-light" > { description } </ Card . Text >
23
+ { ( ! withTitleLink ) && (
24
+ name
41
25
) }
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 >
53
31
) }
54
32
</ 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
+ }
58
46
59
47
CardBody . propTypes = {
60
48
buttonLink : PropTypes . string ,
61
49
// currently overriding the label on a button from being required in this component,
62
50
// because it shouldn't be if we are not rendering a button
63
51
// 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 } ) ,
68
53
// TODO(alishaevn): is there a way to set conditional proptypes without adding another package?
69
54
// buttonProps: props => props.withButtonLink
70
55
// ? PropTypes.shape(Button.propTypes)
@@ -83,7 +68,7 @@ CardBody.propTypes = {
83
68
titleLink : PropTypes . string ,
84
69
withButtonLink : PropTypes . bool ,
85
70
withTitleLink : PropTypes . bool ,
86
- } ;
71
+ }
87
72
88
73
CardBody . defaultProps = {
89
74
buttonLink : '' ,
@@ -95,6 +80,6 @@ CardBody.defaultProps = {
95
80
titleLink : '' ,
96
81
withButtonLink : false ,
97
82
withTitleLink : false ,
98
- } ;
83
+ }
99
84
100
- export default CardBody ;
85
+ export default CardBody
0 commit comments