import React from 'react'; import styled from 'styled-components'; import { components } from 'react-select'; import PropTypes from 'prop-types'; import { get, has, isEmpty } from 'lodash'; import { Flex, Text } from '@buffetjs/core'; import RelationDPState from '../RelationDPState'; const TextGrow = styled(Text)` flex-grow: 2; `; const Option = props => { const Component = components.Option; const hasDraftAndPublish = has(get(props, 'data.value'), 'published_at'); const isDraft = isEmpty(get(props, 'data.value.published_at')); if (hasDraftAndPublish) { return ( {props.label} ); } return ( {props.label} ); }; Option.propTypes = { label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, selectProps: PropTypes.shape({ hasDraftAndPublish: PropTypes.bool, }).isRequired, }; export default Option;