@@ -8,26 +8,42 @@ import styles from './MediaText.module.css'
8
8
/**
9
9
* Render the MediaText component.
10
10
*
11
- * @param {object } props MediaText component props.
12
- * @param {string } props.body The body text.
13
- * @param {string } props.className The className.
14
- * @param {object } props.cta The cta object with text and url strings.
15
- * @param {object } props.image The image object with url and alt text.
16
- * @param {string } props.title The title.
17
- * @return {Element } The MediaText component.
11
+ * @param {object } props MediaText component props.
12
+ * @param {string } props.body The body text.
13
+ * @param {string } props.className The className.
14
+ * @param {object } props.cta The cta object with text and url strings.
15
+ * @param {object } props.image The image object with url and alt text.
16
+ * @param {boolean } props.mediaLeft Whether to show media on the left of the text.
17
+ * @param {string } props.title The title.
18
+ * @return {Element } The MediaText component.
18
19
*/
19
- export default function MediaText ( { body, className, cta, image, title} ) {
20
+ export default function MediaText ( {
21
+ body,
22
+ className,
23
+ cta,
24
+ image,
25
+ mediaLeft,
26
+ title
27
+ } ) {
20
28
return (
21
29
< Container >
22
- < section className = { cn ( styles . mediaText , className ) } >
23
- < div className = { styles . content } >
30
+ < section
31
+ className = { cn (
32
+ styles . mediaText ,
33
+ mediaLeft ? styles . mediaLeft : null ,
34
+ className
35
+ ) }
36
+ >
37
+ < div className = { styles . text } >
24
38
< h1 className = { styles . title } > { title } </ h1 >
25
39
{ body && < p className = { styles . body } > { body } </ p > }
26
40
{ cta && (
27
41
< Button
28
42
className = { styles . button }
29
43
url = { cta . url ? cta . url : null }
30
44
text = { cta . text ? cta . text : null }
45
+ icon = { cta . icon ? cta . icon : null }
46
+ iconPosition = "right"
31
47
type = "primary"
32
48
size = "md"
33
49
/>
@@ -50,26 +66,17 @@ MediaText.propTypes = {
50
66
className : PropTypes . string ,
51
67
cta : PropTypes . shape ( {
52
68
text : PropTypes . string ,
53
- url : PropTypes . string
69
+ url : PropTypes . string ,
70
+ icon : PropTypes . string
54
71
} ) ,
55
72
image : PropTypes . shape ( {
56
73
url : PropTypes . string ,
57
74
alt : PropTypes . string
58
75
} ) ,
76
+ mediaLeft : PropTypes . bool ,
59
77
title : PropTypes . string
60
78
}
61
79
62
80
MediaText . defaultProps = {
63
- title : 'Here is a H2 headline in a bold font.' ,
64
- body :
65
- 'Let me tell you a little story about how I went sledging in the Australian Alps, and got lost in the process. Oh what a riot that was, and I nearly lost...' ,
66
- cta : {
67
- text : 'Learn More' ,
68
- url : '#'
69
- } ,
70
- image : {
71
- url :
72
- 'https://images.unsplash.com/photo-1611458181887-e4a588329222?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60' ,
73
- alt : 'Bridge over river'
74
- }
81
+ mediaLeft : false
75
82
}
0 commit comments