-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement add responsive mobile view for documents table#606 #665
Merged
leekahung
merged 43 commits into
Development
from
enhancement-add-responsive-mobile-view-for-documents-table#606
Sep 4, 2024
Merged
Changes from 15 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
f553a9d
Refactor,Style(Documents): DocumentsTable now uses DocumentPreview co…
joshua-cornett a6bc9d5
refactor(documents): Pull remaining document data for cards. Use elev…
joshua-cornett e924cd4
refactor(documents): Fix delete. Debugging share in case of filenames…
joshua-cornett 984e067
refactor(documents): Fix share. Adjust document URL encoding to follo…
joshua-cornett 200d98f
[refactor,style](documents): Reintegrate desktop documents table. Imp…
joshua-cornett e288c86
refactor(documents): Split desktop and mobile views into separate com…
joshua-cornett 08cf44d
Merge branch 'Development' into enhancement-add-responsive-mobile-vie…
joshua-cornett 4c2090a
Merge branch 'Development' into enhancement-add-responsive-mobile-vie…
joshua-cornett e5f067b
[chore,style](documents - desktop): Complete JSDocs comments for docu…
joshua-cornett 8a7163c
style(mobile documents): Apply mobile contacts styling methodology to…
joshua-cornett e6ee3bb
fix(documents): In light of the concise mapping of documents and the …
joshua-cornett cad0534
style(DesktopDocuments): Restore and capitalize headers
joshua-cornett f963828
chore(DesktopDocuments): Minimized data flow to action items. Extend …
joshua-cornett a41b965
style(DocumentsMobile): Use FileOpenIcon for Preview, in compliance w…
joshua-cornett 9a6aa7d
style(DocumentsMobile): Add Description column header. Adapt styles t…
joshua-cornett c71621d
Merge branch 'Development' into enhancement-add-responsive-mobile-vie…
joshua-cornett d209dbf
style(DocumentsMobile): Move upload and expiration dates to their own…
joshua-cornett 935cab5
style(DocumentsMobile): Remove Type column for consistency with Conta…
joshua-cornett d71aabc
style(DocumentsMobile): Adjust card style to more closely correspond …
joshua-cornett cd26b3d
refactor(utils, documents): Add and integrate getTypeText util for us…
joshua-cornett c5a31a1
[chore, style](DocumentsMobile): Rename 'Name' column to 'Document' i…
joshua-cornett 3e72f85
chore(Documents): Add more thorough commenting
joshua-cornett fb79527
chore(Documents): Add id to Document typedef
joshua-cornett 13b3dbc
chore(Documents): Add id to Document typedef in other references
joshua-cornett eaadf57
[chore,style](DocumentsDesktop): Added default cases for unprovided e…
joshua-cornett cb02e19
chore(Documents): Make comments more consistent with established conv…
joshua-cornett 893cbcc
style(DocumentsMobile): Style more consistently with contacts while s…
joshua-cornett b6159e4
style(DocumentsMobile): Small tweak to actions button. Move slightly …
joshua-cornett 059c856
style(DocumentsMobile): Small tweak to header. Reintroduced margin to…
joshua-cornett fd1d8f1
style(DocumentsMobile): Small tweak to description. Add slight margin…
joshua-cornett e4bcf2f
chore(Documents): Remove inline comments on imports. Move Desktop sty…
joshua-cornett 9f53b0d
[chore,style](Documents): Match header-card margin with card-card mar…
joshua-cornett 436d20b
Merge branch 'Development' into enhancement-add-responsive-mobile-vie…
joshua-cornett 818d3b1
Merge branch 'Development' into enhancement-add-responsive-mobile-vie…
joshua-cornett 1dc61aa
test(Documents): Implement all tests for Documents. Ensure all tests …
joshua-cornett 957ff69
Merge branch 'enhancement-add-responsive-mobile-view-for-documents-ta…
joshua-cornett d2093cb
[chore, style, test](Documents): Remove document name truncation from…
joshua-cornett 65ff06d
Matching Contact and Document card styling
andycwilliams 8740c02
More style matching
andycwilliams 20f1899
More tweaks
andycwilliams 91a816d
Fixing tests
andycwilliams 3eb29c1
Merge branch 'documentcard-edit' into enhancement-add-responsive-mobi…
andycwilliams a0972c0
Final styling adjustments to cards in Contacts and Documents
leekahung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// React Imports | ||
import React, { useState } from 'react'; | ||
// Material UI Imports | ||
import Box from '@mui/material/Box'; | ||
import Button from '@mui/material/Button'; | ||
import Card from '@mui/material/Card'; | ||
import CardContent from '@mui/material/CardContent'; | ||
import FileOpenIcon from '@mui/icons-material/FileOpen'; | ||
import ShareIcon from '@mui/icons-material/Share'; | ||
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Menu from '@mui/material/Menu'; | ||
import MenuItem from '@mui/material/MenuItem'; | ||
import MoreVertIcon from '@mui/icons-material/MoreVert'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
/** | ||
* @typedef {object} Document | ||
* @property {string} name - The given name of the document | ||
* @property {string} type - The given type of the document | ||
* @property {string} description - The given description of the document | ||
* @property {string} uploadDate- The upload date of the document | ||
* @property {string} endDate - The expiration date of the document | ||
* @property {string} fileUrl - The file URL of the document | ||
*/ | ||
|
||
/** | ||
* DocumentCard - Component that contains a document | ||
* | ||
* @memberof Documents | ||
* @name DocumentCard | ||
* @param {object} Props - Component props for Document Preview | ||
* @param {Document} Props.document - The document | ||
* @param {Function} Props.onPreview - The document preview event | ||
* @param {Function} Props.onShare - The document share event | ||
* @param {Function} Props.onDelete - The document delete event | ||
* @returns {React.JSX.Element} React component for DocumentCard | ||
*/ | ||
const DocumentCard = ({ document, onShare, onDelete, onPreview }) => { | ||
const [anchorEl, setAnchorEl] = useState(null); | ||
const [openMenu, setOpenMenu] = useState(null); | ||
|
||
const handleClick = (event, clickedDocument) => { | ||
setAnchorEl(event.currentTarget); | ||
setOpenMenu(clickedDocument.id); | ||
}; | ||
const handleClose = () => { | ||
setAnchorEl(null); | ||
setOpenMenu(null); | ||
}; | ||
|
||
const handleMenuItemClick = (action, clickedDocument) => () => { | ||
action(clickedDocument); | ||
handleClose(); | ||
}; | ||
|
||
const iconSize = { | ||
height: '24px', | ||
width: '24px' | ||
}; | ||
|
||
const iconStyling = { | ||
width: '100%' | ||
}; | ||
|
||
return ( | ||
<Box> | ||
<Card | ||
sx={{ | ||
my: '5px', | ||
position: 'relative' | ||
}} | ||
> | ||
<CardContent> | ||
<Box> | ||
<Typography variant="body1" component="div" noWrap sx={{ maxWidth: '90%' }}> | ||
{document.name || '[No name given]'} | ||
</Typography> | ||
<Box | ||
sx={{ | ||
position: 'absolute', | ||
top: '50%', | ||
right: 5, | ||
transform: 'translateY(-50%)' | ||
}} | ||
> | ||
<IconButton | ||
id="actions-icon-button" | ||
aria-controls={openMenu === document.id ? 'actions-menu' : undefined} | ||
aria-haspopup="true" | ||
aria-expanded={openMenu === document.id ? 'true' : undefined} | ||
onClick={(event) => handleClick(event, document)} | ||
> | ||
<MoreVertIcon /> | ||
</IconButton> | ||
</Box> | ||
</Box> | ||
</CardContent> | ||
<Menu | ||
id="actions-menu" | ||
anchorEl={anchorEl} | ||
open={openMenu === document.id} | ||
onClose={handleClose} | ||
MenuListProps={{ | ||
'aria-labelledby': 'actions-icon-button' | ||
}} | ||
> | ||
<MenuItem | ||
component={Button} | ||
onClick={handleMenuItemClick(onPreview, document)} | ||
startIcon={<FileOpenIcon sx={iconSize} />} | ||
sx={iconStyling} | ||
> | ||
Preview | ||
</MenuItem> | ||
<MenuItem | ||
component={Button} | ||
onClick={handleMenuItemClick(onShare, document)} | ||
startIcon={<ShareIcon sx={iconSize} />} | ||
sx={iconStyling} | ||
> | ||
Share | ||
</MenuItem> | ||
<MenuItem | ||
component={Button} | ||
onClick={handleMenuItemClick(onDelete, document)} | ||
startIcon={<DeleteOutlineOutlinedIcon sx={iconSize} />} | ||
sx={iconStyling} | ||
> | ||
Delete | ||
</MenuItem> | ||
</Menu> | ||
</Card> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default DocumentCard; |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove extra line