Skip to content

Commit 79ec796

Browse files
committed
console: Fix panel
1 parent e49d806 commit 79ec796

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

pkg/webui/components/panel/index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
// limitations under the License.
1414

1515
import React from 'react'
16+
import classnames from 'classnames'
1617

1718
import Message from '@ttn-lw/lib/components/message'
1819

1920
import PropTypes from '@ttn-lw/lib/prop-types'
2021

2122
import Icon from '../icon'
22-
import Button from '../button'
23+
import Link from '../link'
2324

2425
import 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

7183
export default Panel

pkg/webui/components/panel/panel.styl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
line-height: 1
2929

3030
.button
31-
reset-button()
3231
color: #1E5DFF
3332
font-weight: $fwv2.semibold
33+
text-decoration: none
3434

3535
&:hover
36+
color: #1E5DFF
3637
text-decoration: underline
3738

3839
span.panel-header-icon

0 commit comments

Comments
 (0)