1313// limitations under the License.
1414
1515import React from 'react'
16+ import classnames from 'classnames'
1617
1718import Message from '@ttn-lw/lib/components/message'
1819
1920import PropTypes from '@ttn-lw/lib/prop-types'
2021
2122import Icon from '../icon'
22- import Button from '../button '
23+ import Link from '../link '
2324
2425import Toggle from './toggle'
2526
@@ -33,17 +34,23 @@ const Panel = ({
3334 activeToggle,
3435 onToggleClick,
3536 buttonTitle,
37+ path,
38+ className,
39+ messageDecorators,
3640} ) => (
37- < div className = { styles . panel } >
38- < div className = "d-flex j-between mb-cs-xl " >
41+ < div className = { classnames ( styles . panel , className ) } >
42+ < div className = "d-flex j-between mb-cs-m " >
3943 < div className = "d-flex gap-cs-xs al-center" >
4044 { icon && < Icon icon = { icon } className = { styles . panelHeaderIcon } /> }
4145 < Message content = { title } className = { styles . panelHeaderTitle } />
46+ { messageDecorators }
4247 </ div >
4348 { toggleOptions ? (
4449 < Toggle options = { toggleOptions } active = { activeToggle } onToggleChange = { onToggleClick } />
4550 ) : (
46- < Button message = { buttonTitle } unstyled className = { styles . button } />
51+ < Link primary to = { path } className = { styles . button } >
52+ < Message content = { buttonTitle } /> →
53+ </ Link >
4754 ) }
4855 </ div >
4956 { children }
@@ -54,8 +61,11 @@ Panel.propTypes = {
5461 activeToggle : PropTypes . string ,
5562 buttonTitle : PropTypes . string ,
5663 children : PropTypes . node . isRequired ,
64+ className : PropTypes . string ,
5765 icon : PropTypes . string ,
66+ messageDecorators : PropTypes . node ,
5867 onToggleClick : PropTypes . func ,
68+ path : PropTypes . string . isRequired ,
5969 title : PropTypes . message . isRequired ,
6070 toggleOptions : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) ,
6171}
@@ -66,6 +76,8 @@ Panel.defaultProps = {
6676 toggleOptions : undefined ,
6777 activeToggle : undefined ,
6878 onToggleClick : ( ) => null ,
79+ className : undefined ,
80+ messageDecorators : undefined ,
6981}
7082
7183export default Panel
0 commit comments