Added withClearValue prop to select component
This commit is contained in:
@@ -25,6 +25,7 @@ const ProjectBoardIssueDetailsPriority = ({ issue, updateIssue }) => {
|
|||||||
<SectionTitle>Priority</SectionTitle>
|
<SectionTitle>Priority</SectionTitle>
|
||||||
<Select
|
<Select
|
||||||
variant="empty"
|
variant="empty"
|
||||||
|
withClearValue={false}
|
||||||
dropdownWidth={343}
|
dropdownWidth={343}
|
||||||
value={issue.priority}
|
value={issue.priority}
|
||||||
options={Object.values(IssuePriority).map(priority => ({
|
options={Object.values(IssuePriority).map(priority => ({
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const ProjectBoardIssueDetailsStatus = ({ issue, updateIssue }) => (
|
|||||||
<Select
|
<Select
|
||||||
variant="empty"
|
variant="empty"
|
||||||
dropdownWidth={343}
|
dropdownWidth={343}
|
||||||
|
withClearValue={false}
|
||||||
value={issue.status}
|
value={issue.status}
|
||||||
options={Object.values(IssueStatus).map(status => ({
|
options={Object.values(IssueStatus).map(status => ({
|
||||||
value: status,
|
value: status,
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ const ProjectBoardIssueDetailsTracking = ({ issue, updateIssue }) => {
|
|||||||
<SectionTitle>Time Tracking</SectionTitle>
|
<SectionTitle>Time Tracking</SectionTitle>
|
||||||
<Modal
|
<Modal
|
||||||
width={400}
|
width={400}
|
||||||
renderLink={modal => <TrackingLink>{renderTrackingWidget(modal.open)}</TrackingLink>}
|
renderLink={modal => (
|
||||||
|
<TrackingLink onClick={modal.open}>{renderTrackingWidget()}</TrackingLink>
|
||||||
|
)}
|
||||||
renderContent={modal => (
|
renderContent={modal => (
|
||||||
<ModalContents>
|
<ModalContents>
|
||||||
<ModalTitle>Time tracking</ModalTitle>
|
<ModalTitle>Time tracking</ModalTitle>
|
||||||
@@ -77,8 +79,8 @@ const ProjectBoardIssueDetailsTracking = ({ issue, updateIssue }) => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderTrackingWidget = (onClick = () => {}) => (
|
const renderTrackingWidget = () => (
|
||||||
<Tracking onClick={onClick}>
|
<Tracking>
|
||||||
<WatchIcon type="stopwatch" size={26} top={-1} />
|
<WatchIcon type="stopwatch" size={26} top={-1} />
|
||||||
<Right>
|
<Right>
|
||||||
<BarCont>
|
<BarCont>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const ProjectBoardIssueDetailsType = ({ issue, updateIssue }) => (
|
|||||||
<Select
|
<Select
|
||||||
variant="empty"
|
variant="empty"
|
||||||
dropdownWidth={150}
|
dropdownWidth={150}
|
||||||
|
withClearValue={false}
|
||||||
value={issue.type}
|
value={issue.type}
|
||||||
options={Object.values(IssueType).map(type => ({
|
options={Object.values(IssueType).map(type => ({
|
||||||
value: type,
|
value: type,
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const ProjectBoardIssueDetailsUsers = ({ issue, updateIssue, projectUsers }) =>
|
|||||||
<Select
|
<Select
|
||||||
variant="empty"
|
variant="empty"
|
||||||
dropdownWidth={343}
|
dropdownWidth={343}
|
||||||
|
withClearValue={false}
|
||||||
value={issue.reporterId}
|
value={issue.reporterId}
|
||||||
options={userOptions}
|
options={userOptions}
|
||||||
onChange={userId => updateIssue({ reporterId: userId })}
|
onChange={userId => updateIssue({ reporterId: userId })}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import ReactDOM from 'react-dom';
|
|||||||
|
|
||||||
import App from 'App';
|
import App from 'App';
|
||||||
|
|
||||||
// APP IS NOT RESPONSIVE - REDUCE BROWSER HEIGHT, ISSUES DONT SCROLL
|
|
||||||
|
|
||||||
// TODO: UPDATE FORMIK TO FIX SETFIELDVALUE TO EMPTY ARRAY ISSUE https://github.com/jaredpalmer/formik/pull/2144
|
|
||||||
|
|
||||||
// REFACTOR HTML TO USE SEMANTIC ELEMENTS
|
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('root'));
|
ReactDOM.render(<App />, document.getElementById('root'));
|
||||||
|
|
||||||
|
// APP IS NOT RESPONSIVE - REDUCE BROWSER HEIGHT, ISSUES DONT SCROLL
|
||||||
|
// TODO: UPDATE FORMIK TO FIX SETFIELDVALUE TO EMPTY ARRAY ISSUE https://github.com/jaredpalmer/formik/pull/2144
|
||||||
|
// REFACTOR HTML TO USE SEMANTIC ELEMENTS
|
||||||
|
// MOVE SOME UTILS LIKE API TO SERVICES FOLDER
|
||||||
|
// RENAME ISSUE DETAILS "USERS" TO ASSIGNEESREPORTER
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ const propTypes = {
|
|||||||
options: PropTypes.array.isRequired,
|
options: PropTypes.array.isRequired,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
onCreate: PropTypes.func,
|
onCreate: PropTypes.func,
|
||||||
isMulti: PropTypes.bool,
|
isMulti: PropTypes.bool.isRequired,
|
||||||
|
withClearValue: PropTypes.bool.isRequired,
|
||||||
propsRenderOption: PropTypes.func,
|
propsRenderOption: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,7 +26,6 @@ const defaultProps = {
|
|||||||
dropdownWidth: undefined,
|
dropdownWidth: undefined,
|
||||||
value: undefined,
|
value: undefined,
|
||||||
onCreate: undefined,
|
onCreate: undefined,
|
||||||
isMulti: false,
|
|
||||||
propsRenderOption: undefined,
|
propsRenderOption: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,6 +41,7 @@ const SelectDropdown = ({
|
|||||||
onChange,
|
onChange,
|
||||||
onCreate,
|
onCreate,
|
||||||
isMulti,
|
isMulti,
|
||||||
|
withClearValue,
|
||||||
propsRenderOption,
|
propsRenderOption,
|
||||||
}) => {
|
}) => {
|
||||||
const [isCreatingOption, setCreatingOption] = useState(false);
|
const [isCreatingOption, setCreatingOption] = useState(false);
|
||||||
@@ -204,7 +205,7 @@ const SelectDropdown = ({
|
|||||||
onKeyDown={handleInputKeyDown}
|
onKeyDown={handleInputKeyDown}
|
||||||
onChange={event => setSearchValue(event.target.value)}
|
onChange={event => setSearchValue(event.target.value)}
|
||||||
/>
|
/>
|
||||||
{!isValueEmpty && <ClearIcon type="close" onClick={clearOptionValues} />}
|
{!isValueEmpty && withClearValue && <ClearIcon type="close" onClick={clearOptionValues} />}
|
||||||
<Options ref={$optionsRef}>
|
<Options ref={$optionsRef}>
|
||||||
{filteredOptions.map(renderSelectableOption)}
|
{filteredOptions.map(renderSelectableOption)}
|
||||||
{isOptionCreatable && renderCreatableOption()}
|
{isOptionCreatable && renderCreatableOption()}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const propTypes = {
|
|||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
onCreate: PropTypes.func,
|
onCreate: PropTypes.func,
|
||||||
isMulti: PropTypes.bool,
|
isMulti: PropTypes.bool,
|
||||||
|
withClearValue: PropTypes.bool,
|
||||||
renderValue: PropTypes.func,
|
renderValue: PropTypes.func,
|
||||||
renderOption: PropTypes.func,
|
renderOption: PropTypes.func,
|
||||||
};
|
};
|
||||||
@@ -42,6 +43,7 @@ const defaultProps = {
|
|||||||
invalid: false,
|
invalid: false,
|
||||||
onCreate: undefined,
|
onCreate: undefined,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
|
withClearValue: true,
|
||||||
renderValue: undefined,
|
renderValue: undefined,
|
||||||
renderOption: undefined,
|
renderOption: undefined,
|
||||||
};
|
};
|
||||||
@@ -58,6 +60,7 @@ const Select = ({
|
|||||||
onChange,
|
onChange,
|
||||||
onCreate,
|
onCreate,
|
||||||
isMulti,
|
isMulti,
|
||||||
|
withClearValue,
|
||||||
renderValue: propsRenderValue,
|
renderValue: propsRenderValue,
|
||||||
renderOption: propsRenderOption,
|
renderOption: propsRenderOption,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -184,6 +187,7 @@ const Select = ({
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onCreate={onCreate}
|
onCreate={onCreate}
|
||||||
isMulti={isMulti}
|
isMulti={isMulti}
|
||||||
|
withClearValue={withClearValue}
|
||||||
propsRenderOption={propsRenderOption}
|
propsRenderOption={propsRenderOption}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import api from 'shared/utils/api';
|
|||||||
import useMergeState from 'shared/hooks/mergeState';
|
import useMergeState from 'shared/hooks/mergeState';
|
||||||
import useDeepCompareMemoize from 'shared/hooks/deepCompareMemoize';
|
import useDeepCompareMemoize from 'shared/hooks/deepCompareMemoize';
|
||||||
|
|
||||||
const useQuery = (url, propsVariables = {}, { lazy = false, cachePolicy = 'cache-first' } = {}) => {
|
const useQuery = (url, propsVariables = {}, options = {}) => {
|
||||||
|
const { lazy = false, cachePolicy = 'cache-first' } = options;
|
||||||
|
|
||||||
const [state, mergeState] = useMergeState({
|
const [state, mergeState] = useMergeState({
|
||||||
data: null,
|
data: null,
|
||||||
error: null,
|
error: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user