-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1124 from samwel141/master
Showing Sub-organizations as dropdown from the organization of a Grower
- Loading branch information
Showing
5 changed files
with
116 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import { | ||
Paper, | ||
Typography, | ||
List, | ||
ListItem, | ||
Collapse, | ||
FormControlLabel, | ||
Radio, | ||
ListItemText, | ||
} from '@material-ui/core'; | ||
|
||
const SubOrgs = ({ name, id }) => { | ||
const [expanded, setExpanded] = React.useState(false); | ||
|
||
const handleExpandClick = () => { | ||
setExpanded(!expanded); | ||
}; | ||
const subOrganizations = [ | ||
'Sub-organization1', | ||
'Sub-organization2', | ||
'Sub-organization3', | ||
]; | ||
|
||
return ( | ||
<> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<Paper | ||
elevation={0} | ||
style={{ | ||
width: '200px', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
padding: '20px', | ||
cursor: 'pointer', | ||
}} | ||
> | ||
<Typography variant="h6"> | ||
{name} ({id}) | ||
</Typography> | ||
</div> | ||
<Collapse in={expanded} style={{ padding: '10px', marginTop: '0' }}> | ||
<div> | ||
<List> | ||
{subOrganizations.map((subOrg, index) => ( | ||
<ListItem key={index}> | ||
<ListItemText primary={subOrg} /> | ||
</ListItem> | ||
))} | ||
</List> | ||
</div> | ||
</Collapse> | ||
</Paper> | ||
<div style={{ position: 'relative' }}> | ||
<FormControlLabel | ||
control={<Radio checked={expanded} onClick={handleExpandClick} />} | ||
label="Sub-organization/s" | ||
style={{ | ||
right: '0', | ||
position: 'absolute', | ||
top: '15px', | ||
left: '-160px', | ||
display: 'block', | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default SubOrgs; |