1
- import React from ' react'
2
- import PropTypes from ' prop-types'
3
- import { Card } from ' react-bootstrap'
4
- import NextLink from ' ../../components/NextLink/NextLink'
5
- import LinkedButton from ' ../LinkedButton/LinkedButton'
1
+ import React from " react" ;
2
+ import PropTypes from " prop-types" ;
3
+ import { Card } from " react-bootstrap" ;
4
+ import NextLink from " ../../components/NextLink/NextLink" ;
5
+ import LinkedButton from " ../LinkedButton/LinkedButton" ;
6
6
7
- const CardBody = ( { buttonLink, buttonProps, item,
8
- orientation, titleLink, withButtonLink, withTitleLink } ) => {
9
- const { id, description, name } = item
7
+ const CardBody = ( {
8
+ buttonLink,
9
+ buttonProps,
10
+ item,
11
+ orientation,
12
+ titleLink,
13
+ withButtonLink,
14
+ withTitleLink,
15
+ } ) => {
16
+ const { id, description, name } = item ;
10
17
11
18
return (
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 >
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 >
16
29
{ ( withTitleLink ) && (
17
- < NextLink
18
- text = { name }
19
- path = { { pathname : titleLink , query : { id } } }
20
- addClass = 'text-decoration-none link-hover'
21
- />
22
- ) }
23
- { ( ! withTitleLink ) && (
24
- name
30
+ < NextLink
31
+ text = { name }
32
+ path = { { pathname : titleLink , query : { id } } }
33
+ addClass = "text-decoration-none link-hover"
34
+ /> ) }
35
+ { ( ! withTitleLink ) && (
36
+ name
25
37
) }
26
38
</ Card . Title >
27
- { description && (
28
- < Card . Text className = 'fw-light' >
29
- { description }
30
- </ Card . Text >
39
+ { description && (
40
+ < Card . Text className = "fw-light" > { description } </ Card . Text >
41
+ ) }
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 >
31
53
) }
32
54
</ div >
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
- }
55
+ </ Card . Body >
56
+ ) ;
57
+ } ;
46
58
47
59
CardBody . propTypes = {
48
60
buttonLink : PropTypes . string ,
49
61
// currently overriding the label on a button from being required in this component,
50
62
// because it shouldn't be if we are not rendering a button
51
63
// refer to the comment below
52
- buttonProps : PropTypes . shape ( { ...LinkedButton . propTypes . buttonProps , label : PropTypes . string } ) ,
64
+ buttonProps : PropTypes . shape ( {
65
+ ...LinkedButton . propTypes . buttonProps ,
66
+ label : PropTypes . string ,
67
+ } ) ,
53
68
// TODO(alishaevn): is there a way to set conditional proptypes without adding another package?
54
69
// buttonProps: props => props.withButtonLink
55
70
// ? PropTypes.shape(Button.propTypes)
@@ -64,22 +79,22 @@ CardBody.propTypes = {
64
79
name : PropTypes . string . isRequired ,
65
80
slug : PropTypes . string ,
66
81
} ) ,
67
- orientation : PropTypes . oneOf ( [ ' horizontal' , ' vertical' ] ) ,
82
+ orientation : PropTypes . oneOf ( [ " horizontal" , " vertical" ] ) ,
68
83
titleLink : PropTypes . string ,
69
84
withButtonLink : PropTypes . bool ,
70
85
withTitleLink : PropTypes . bool ,
71
- }
86
+ } ;
72
87
73
88
CardBody . defaultProps = {
74
- buttonLink : '' ,
89
+ buttonLink : "" ,
75
90
buttonProps : LinkedButton . defaultProps ,
76
91
item : {
77
- description : '' ,
92
+ description : "" ,
78
93
} ,
79
- orientation : ' vertical' ,
80
- titleLink : '' ,
94
+ orientation : " vertical" ,
95
+ titleLink : "" ,
81
96
withButtonLink : false ,
82
97
withTitleLink : false ,
83
- }
98
+ } ;
84
99
85
- export default CardBody
100
+ export default CardBody ;
0 commit comments