pull/3183/head
parent
d3662f2302
commit
1af3e0bd93
@ -0,0 +1,23 @@
|
|||||||
|
.optionText {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex: 1 0 0;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
&.isMobile {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
.hintText {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hintText {
|
||||||
|
@add-mixin truncate;
|
||||||
|
|
||||||
|
margin-left: 15px;
|
||||||
|
color: $darkGray;
|
||||||
|
font-size: $smallFontSize;
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import EnhancedSelectInputOption from './EnhancedSelectInputOption';
|
||||||
|
import styles from './HintedSelectInputOption.css';
|
||||||
|
|
||||||
|
function HintedSelectInputOption(props) {
|
||||||
|
const {
|
||||||
|
value,
|
||||||
|
hint,
|
||||||
|
isMobile,
|
||||||
|
...otherProps
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<EnhancedSelectInputOption
|
||||||
|
isMobile={isMobile}
|
||||||
|
{...otherProps}
|
||||||
|
>
|
||||||
|
<div className={classNames(
|
||||||
|
styles.optionText,
|
||||||
|
isMobile && styles.isMobile
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div>{value}</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
hint != null &&
|
||||||
|
<div className={styles.hintText}>
|
||||||
|
{hint}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</EnhancedSelectInputOption>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
HintedSelectInputOption.propTypes = {
|
||||||
|
value: PropTypes.string.isRequired,
|
||||||
|
hint: PropTypes.node,
|
||||||
|
isMobile: PropTypes.bool.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HintedSelectInputOption;
|
@ -0,0 +1,24 @@
|
|||||||
|
.selectedValue {
|
||||||
|
composes: selectedValue from '~./EnhancedSelectInputSelectedValue.css';
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.valueText {
|
||||||
|
@add-mixin truncate;
|
||||||
|
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hintText {
|
||||||
|
@add-mixin truncate;
|
||||||
|
|
||||||
|
flex: 1 10 0;
|
||||||
|
margin-left: 15px;
|
||||||
|
color: $gray;
|
||||||
|
text-align: right;
|
||||||
|
font-size: $smallFontSize;
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React from 'react';
|
||||||
|
import EnhancedSelectInputSelectedValue from './EnhancedSelectInputSelectedValue';
|
||||||
|
import styles from './HintedSelectInputSelectedValue.css';
|
||||||
|
|
||||||
|
function HintedSelectInputSelectedValue(props) {
|
||||||
|
const {
|
||||||
|
value,
|
||||||
|
hint,
|
||||||
|
includeHint,
|
||||||
|
...otherProps
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<EnhancedSelectInputSelectedValue
|
||||||
|
className={styles.selectedValue}
|
||||||
|
{...otherProps}
|
||||||
|
>
|
||||||
|
<div className={styles.valueText}>
|
||||||
|
{value}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
hint != null && includeHint &&
|
||||||
|
<div className={styles.hintText}>
|
||||||
|
{hint}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</EnhancedSelectInputSelectedValue>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
HintedSelectInputSelectedValue.propTypes = {
|
||||||
|
value: PropTypes.string,
|
||||||
|
hint: PropTypes.string,
|
||||||
|
includeHint: PropTypes.bool.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
HintedSelectInputSelectedValue.defaultProps = {
|
||||||
|
includeHint: true
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HintedSelectInputSelectedValue;
|
Loading…
Reference in new issue