2018-12-21 22:18:05 +03:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-08-22 03:13:24 +03:00
|
|
|
import { StylingFunction } from 'react-base16-styling';
|
2018-12-21 22:18:05 +03:00
|
|
|
|
2020-08-22 03:13:24 +03:00
|
|
|
interface Props {
|
|
|
|
styling: StylingFunction;
|
|
|
|
arrowStyle?: 'single' | 'double';
|
|
|
|
expanded: boolean;
|
|
|
|
nodeType: string;
|
|
|
|
onClick: React.MouseEventHandler<HTMLDivElement>;
|
|
|
|
}
|
|
|
|
|
|
|
|
const JSONArrow: React.FunctionComponent<Props> = ({
|
|
|
|
styling,
|
|
|
|
arrowStyle,
|
|
|
|
expanded,
|
|
|
|
nodeType,
|
|
|
|
onClick,
|
|
|
|
}) => (
|
2018-12-21 22:18:05 +03:00
|
|
|
<div {...styling('arrowContainer', arrowStyle)} onClick={onClick}>
|
|
|
|
<div {...styling(['arrow', 'arrowSign'], nodeType, expanded, arrowStyle)}>
|
|
|
|
{'\u25B6'}
|
|
|
|
{arrowStyle === 'double' && (
|
|
|
|
<div {...styling(['arrowSign', 'arrowSignInner'])}>{'\u25B6'}</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
JSONArrow.propTypes = {
|
|
|
|
styling: PropTypes.func.isRequired,
|
|
|
|
arrowStyle: PropTypes.oneOf(['single', 'double']),
|
|
|
|
expanded: PropTypes.bool.isRequired,
|
|
|
|
nodeType: PropTypes.string.isRequired,
|
2020-08-08 23:26:39 +03:00
|
|
|
onClick: PropTypes.func.isRequired,
|
2018-12-21 22:18:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
JSONArrow.defaultProps = {
|
2020-08-08 23:26:39 +03:00
|
|
|
arrowStyle: 'single',
|
2018-12-21 22:18:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default JSONArrow;
|