-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathConsoleExpression.jsx
More file actions
41 lines (35 loc) · 1000 Bytes
/
ConsoleExpression.jsx
File metadata and controls
41 lines (35 loc) · 1000 Bytes
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
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import {faChevronRight} from '@fortawesome/free-solid-svg-icons';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import isNil from 'lodash-es/isNil';
import {ConsoleEntry as ConsoleEntryRecord} from '../records';
import styles from './ConsoleExpression.module.css';
export default function ConsoleExpression({entry: {expression}, isActive}) {
if (isNil(expression)) {
return null;
}
return (
<div
className={
classnames(
styles.expression,
{[styles.inactive]: !isActive},
)
}
>
<div className={styles.chevron}>
<FontAwesomeIcon icon={faChevronRight} />
</div>
{expression}
</div>
);
}
ConsoleExpression.propTypes = {
entry: PropTypes.instanceOf(ConsoleEntryRecord).isRequired,
isActive: PropTypes.bool.isRequired,
};
ConsoleExpression.defaultProps = {
expression: null,
};