File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change 11import React , { FunctionComponent } from "react" ;
22import { MenuItem , Select } from "@material-ui/core" ;
3- import {
4- useProjectState ,
5- } from "../contexts/project.context" ;
3+ import { useProjectState } from "../contexts/project.context" ;
64import { useHistory } from "react-router-dom" ;
75
86const ProjectSelect : FunctionComponent < {
@@ -23,17 +21,21 @@ const ProjectSelect: FunctionComponent<{
2321 } ;
2422
2523 return (
26- < Select
27- id = "project-select"
28- value = { selectedId }
29- onChange = { handleProjectSelect }
30- >
31- { projectState . projectList . map ( ( project ) => (
32- < MenuItem key = { project . id } value = { project . id } >
33- { project . name }
34- </ MenuItem >
35- ) ) }
36- </ Select >
24+ < React . Fragment >
25+ { projectState . projectList . length > 0 && (
26+ < Select
27+ id = "project-select"
28+ value = { selectedId }
29+ onChange = { handleProjectSelect }
30+ >
31+ { projectState . projectList . map ( ( project ) => (
32+ < MenuItem key = { project . id } value = { project . id } >
33+ { project . name }
34+ </ MenuItem >
35+ ) ) }
36+ </ Select >
37+ ) }
38+ </ React . Fragment >
3739 ) ;
3840} ;
3941
You can’t perform that action at this time.
0 commit comments