-
Notifications
You must be signed in to change notification settings - Fork 68
feat: Implement grid layout ✨ #3421
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
Conversation
src/components/App/App.jsx
Outdated
</ModalContextProvider> | ||
</ThumbnailSizeContextProvider> | ||
<ViewSwitcherContextProvider> | ||
<ThumbnailSizeContextProvider> |
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.
Since you replace this thumbnail size, you should remove it from everywhere.
src/modules/filelist/File.jsx
Outdated
[styles['fil-content-column-selected']]: selected, | ||
[styles['fil-content-column-actioned']]: actionMenuVisible, | ||
[styles['fil-content-column-disabled']]: styleDisabled, | ||
[styles['fil-content-column-bigger']]: thumbnailSizeBig |
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 we still have thumbnailSizeBig
?
src/modules/filelist/File.jsx
Outdated
)} | ||
</TableRow> | ||
</> |
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.
do we really need to have this full copy / past between list & grid? Can't we make a few if? Because it seems that there is a lot of stuff that are just duplicated
@@ -76,11 +76,11 @@ const FileListHeaderMobile = ({ | |||
<Button | |||
variant="text" | |||
onClick={() => { | |||
toggleThumbnailSize() | |||
toggleViewType(viewType === 'list' ? 'grid' : 'list') |
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.
Why can't we just toggleViewType()
? For me, toggle can only have two values and we change from one to another. So we should not test the previous value every time we want to change. This should be done within the provider.
Otherwise, rename this method to switchViewType and in that case you can do what you did, but I still prefer the first solution.
) | ||
import { useViewSwitcherContext } from '@/lib/ViewSwitcherContext' | ||
|
||
const SelectBox = ({ withSelectionCheckbox, selected, onClick, disabled }) => { |
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.
This component should be dump, and should not rely on the hook. Pass a viewType
props directly.
<FileIcon file={file} size={48} isEncrypted={isEncrypted} /> | ||
<FileIcon | ||
file={file} | ||
size={viewType === 'grid' ? 96 : 48} |
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.
why don't you pass 96
when you call FileThumbnail
? Like that, no need to rely on the hook.
src/styles/filelist.styl
Outdated
.fil-content-file-select | ||
position absolute | ||
top -4px | ||
left -3px |
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.
what are those magic numbers? Are you sure it still works if you change your font size? Should we use rem
or something here?
src/styles/filelist.styl
Outdated
position absolute | ||
top -4px | ||
left -3px | ||
z-index 1 |
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 you @require 'settings/z-index.styl'
and then use the zIndex variable you need?
src/styles/filelist.styl
Outdated
white-space normal | ||
height auto | ||
padding-right 0 | ||
margin-top 10px |
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.
don't use px, you rem please
test/components/AppLike.jsx
Outdated
</BreakpointsProvider> | ||
</ThumbnailSizeContextProvider> | ||
<ViewSwitcherContextProvider> | ||
<ThumbnailSizeContextProvider> |
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.
remove ThumbnailSizeContextProvider
Can you split your PR into at least 2 commits:
Also, what about |
@Crash-- the FolderViewBodyVz is using virtualized table from cozy-ui, I think this is a big change if we want to apply grid layout |
BundleMonFiles updated (5)
Unchanged files (16)
Total files change +2.66KB +0.05% Groups updated (2)
Unchanged groups (1)
Final result: ✅ View report in BundleMon website ➡️ |
6fa0052
to
5475442
Compare
src/styles/filelist.styl
Outdated
text-overflow ellipsis | ||
white-space normal | ||
|
||
max-width 96px |
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.
This will unnecessarily truncate the file/folder names, and it's in px.
use max-width 100% instead
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.
If use max-width 100%, we cannot limit the long text, so I changed to 6rem instead
src/styles/folder-view.styl
Outdated
@@ -0,0 +1,4 @@ | |||
.fil-folder-body-grid | |||
display grid | |||
grid-template-columns repeat(auto-fill, minmax(140px, 1fr)) |
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.
grid-template-columns repeat(auto-fill, minmax(140px, 1fr)) | |
grid-template-columns repeat(auto-fill, minmax(8.4rem, 1fr)) |
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.
Uh oh!
There was an error while loading. Please reload this page.