-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add process screens in role form * Add infinite list component * Add top scroll when rerender
- Loading branch information
Sergio Betanzos
authored
Sep 16, 2020
1 parent
12d87e7
commit a680a4c
Showing
30 changed files
with
793 additions
and
171 deletions.
There are no files selected for viewing
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,73 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import clsx from 'clsx'; | ||
|
||
import { Card, CardActionArea, Fade, makeStyles } from '@material-ui/core'; | ||
import { Skeleton } from '@material-ui/lab'; | ||
|
||
import useNearScreen from 'client/hooks/useNearScreen'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
height: '100%' | ||
}, | ||
selected: { | ||
color: theme.palette.primary.contrastText, | ||
backgroundColor: theme.palette.primary.main | ||
}, | ||
actionArea: { | ||
height: '100%', | ||
minHeight: 140, | ||
padding: theme.spacing(1) | ||
} | ||
})); | ||
|
||
const SelectCard = React.memo( | ||
({ isSelected, handleSelect, handleUnselect, ID, NAME }) => { | ||
const classes = useStyles(); | ||
const { isNearScreen, fromRef } = useNearScreen({ | ||
distance: '100px' | ||
}); | ||
|
||
return ( | ||
<div ref={fromRef}> | ||
{isNearScreen ? ( | ||
<Fade in={isNearScreen}> | ||
<Card | ||
className={clsx(classes.root, { [classes.selected]: isSelected })} | ||
> | ||
<CardActionArea | ||
className={classes.actionArea} | ||
onClick={() => | ||
isSelected ? handleUnselect(ID) : handleSelect(ID) | ||
} | ||
> | ||
<span>{`📦 ${NAME}`}</span> | ||
</CardActionArea> | ||
</Card> | ||
</Fade> | ||
) : ( | ||
<Skeleton variant="rect" width="100%" height={140} /> | ||
)} | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
SelectCard.propTypes = { | ||
isSelected: PropTypes.bool, | ||
handleSelect: PropTypes.func, | ||
handleUnselect: PropTypes.func, | ||
ID: PropTypes.string, | ||
NAME: PropTypes.string | ||
}; | ||
|
||
SelectCard.defaultProps = { | ||
isSelected: false, | ||
handleSelect: () => undefined, | ||
handleUnselect: () => undefined, | ||
ID: undefined, | ||
NAME: undefined | ||
}; | ||
|
||
export default SelectCard; |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import ClusterCard from 'client/components/Cards/ClusterCard'; | ||
import NetworkCard from 'client/components/Cards/NetworkCard'; | ||
import RoleCard from 'client/components/Cards/RoleCard'; | ||
import SelectCard from 'client/components/Cards/SelectCard'; | ||
|
||
export { ClusterCard, NetworkCard, RoleCard }; | ||
export { ClusterCard, NetworkCard, RoleCard, SelectCard }; |
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
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
Oops, something went wrong.