forked from platformatic/ui-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfoBox.jsx
More file actions
58 lines (54 loc) · 1.55 KB
/
Copy pathInfoBox.jsx
File metadata and controls
58 lines (54 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict'
import React from 'react'
import PropTypes from 'prop-types'
import styles from './InfoBox.module.css'
import Button from './Button'
import PlatformaticIcon from './PlatformaticIcon'
import { COLORS_BUTTON, COLORS_ICON, HOVER_EFFECTS_BUTTONS } from './constants'
function InfoBox ({ children, iconName, iconColor, helpText, buttonProps }) {
return (
<div className={styles.container}>
<PlatformaticIcon size='extra-large' iconName={iconName} color={iconColor} />
{children}
<p className={styles.helpText}>{helpText}</p>
{buttonProps && (<Button type='button' size='extra-large' label={buttonProps.label} color={buttonProps.color} backgroundColor={buttonProps.backgroundColor} onClick={() => buttonProps.onClick()} fullWidth bold bordered={buttonProps.bordered} hoverEffect={buttonProps.hoverEffect} />)}
</div>
)
}
InfoBox.propTypes = {
/**
* children
*/
children: PropTypes.node,
/**
* iconName
*/
iconName: PropTypes.string,
/**
* iconColor
*/
iconColor: PropTypes.oneOf(COLORS_ICON),
/**
* helpText
*/
helpText: PropTypes.string,
/**
* background color of the button
*/
buttonProps: PropTypes.shape({
label: PropTypes.string,
backgroundColor: PropTypes.string,
color: PropTypes.oneOf(COLORS_BUTTON),
hoverEffect: PropTypes.oneOf(HOVER_EFFECTS_BUTTONS),
bordered: PropTypes.bool,
onClick: PropTypes.func
})
}
InfoBox.defaultProps = {
children: null,
iconName: '',
iconColor: 'main-green',
helpText: '',
buttonProps: null
}
export default InfoBox