added hint text to all selection bar icon

This commit is contained in:
abhinav-grd 2021-09-24 11:31:43 +05:30
parent a51e209f4b
commit 1bf346a835
2 changed files with 47 additions and 17 deletions

View file

@ -13,10 +13,18 @@ import MoveIcon from 'components/icons/MoveIcon';
import { COLLECTION_OPS_TYPE } from 'utils/collection'; import { COLLECTION_OPS_TYPE } from 'utils/collection';
import { ALL_SECTION, ARCHIVE_SECTION } from './Collections'; import { ALL_SECTION, ARCHIVE_SECTION } from './Collections';
import UnArchive from 'components/icons/UnArchive'; import UnArchive from 'components/icons/UnArchive';
import { OverlayTrigger } from 'react-bootstrap';
import { Collection } from 'services/collectionService';
interface Props { interface Props {
addToCollectionHelper: (collectionName, collection) => void; addToCollectionHelper: (
moveToCollectionHelper: (collectionName, collection) => void; collectionName: string,
collection: Collection
) => void;
moveToCollectionHelper: (
collectionName: string,
collection: Collection
) => void;
showCreateCollectionModal: (opsType: COLLECTION_OPS_TYPE) => () => void; showCreateCollectionModal: (opsType: COLLECTION_OPS_TYPE) => () => void;
setDialogMessage: SetDialogMessage; setDialogMessage: SetDialogMessage;
setCollectionSelectorAttributes: SetCollectionSelectorAttributes; setCollectionSelectorAttributes: SetCollectionSelectorAttributes;
@ -34,6 +42,7 @@ const SelectionBar = styled(Navbar)`
color: #fff; color: #fff;
z-index: 1001; z-index: 1001;
width: 100%; width: 100%;
padding: 0 16px;
`; `;
const SelectionContainer = styled.div` const SelectionContainer = styled.div`
@ -85,6 +94,14 @@ const SelectedFileOptions = ({
}); });
}; };
const IconWithMessage = (props) => (
<OverlayTrigger
placement="bottom"
overlay={<p style={{ zIndex: 1002 }}>{props.message}</p>}>
{props.children}
</OverlayTrigger>
);
return ( return (
<SelectionBar> <SelectionBar>
<SelectionContainer> <SelectionContainer>
@ -96,27 +113,37 @@ const SelectedFileOptions = ({
</div> </div>
</SelectionContainer> </SelectionContainer>
{activeCollection === ARCHIVE_SECTION ? ( {activeCollection === ARCHIVE_SECTION ? (
<IconWithMessage message={constants.UNARCHIVE}>
<IconButton onClick={unArchiveFilesHelper}> <IconButton onClick={unArchiveFilesHelper}>
<UnArchive /> <UnArchive />
</IconButton> </IconButton>
</IconWithMessage>
) : ( ) : (
<> <>
{activeCollection === ALL_SECTION && ( {activeCollection === ALL_SECTION && (
<IconWithMessage message={constants.ARCHIVE}>
<IconButton onClick={archiveFilesHelper}> <IconButton onClick={archiveFilesHelper}>
<Archive /> <Archive />
</IconButton> </IconButton>
</IconWithMessage>
)} )}
{activeCollection !== ALL_SECTION && ( {activeCollection !== ALL_SECTION && (
<IconWithMessage message={constants.MOVE}>
<IconButton onClick={moveToCollection}> <IconButton onClick={moveToCollection}>
<MoveIcon /> <MoveIcon />
</IconButton> </IconButton>
</IconWithMessage>
)} )}
<IconWithMessage message={constants.ADD}>
<IconButton onClick={addToCollection}> <IconButton onClick={addToCollection}>
<AddIcon /> <AddIcon />
</IconButton> </IconButton>
</IconWithMessage>
<IconWithMessage message={constants.DELETE}>
<IconButton onClick={deleteHandler}> <IconButton onClick={deleteHandler}>
<DeleteIcon /> <DeleteIcon />
</IconButton> </IconButton>
</IconWithMessage>
</> </>
)} )}
</SelectionBar> </SelectionBar>

View file

@ -545,6 +545,9 @@ const englishConstants = {
ARCHIVE: 'archive', ARCHIVE: 'archive',
ALL: 'all', ALL: 'all',
MOVE_TO_COLLECTION: 'move to collection', MOVE_TO_COLLECTION: 'move to collection',
UNARCHIVE: 'un-archive',
MOVE: 'move',
ADD: 'add',
}; };
export default englishConstants; export default englishConstants;