Skip to content

Commit d30d7de

Browse files
artongeskjnldsv
authored andcommitted
feat(files): Refresh grid view layout
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent e8790f0 commit d30d7de

4 files changed

Lines changed: 62 additions & 37 deletions

File tree

apps/files/src/components/FilesListVirtual.vue

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export default defineComponent({
316316
317317
--checkbox-padding: calc((var(--row-height) - var(--checkbox-size)) / 2);
318318
--checkbox-size: 24px;
319-
--clickable-area: 44px;
319+
--clickable-area: var(--default-clickable-area);
320320
--icon-preview-size: 32px;
321321
322322
overflow: auto;
@@ -687,39 +687,56 @@ export default defineComponent({
687687
// Grid mode
688688
tbody.files-list__tbody.files-list__tbody--grid {
689689
--half-clickable-area: calc(var(--clickable-area) / 2);
690-
--row-width: 160px;
691-
// We use half of the clickable area as visual balance margin
692-
--row-height: calc(var(--row-width) - var(--half-clickable-area));
693-
--icon-preview-size: calc(var(--row-width) - var(--clickable-area));
690+
--item-padding: 16px;
691+
--icon-preview-size: 208px;
692+
--name-height: 32px;
693+
--mtime-height: 16px;
694+
--row-width: calc(var(--icon-preview-size));
695+
--row-height: calc(var(--icon-preview-size) + var(--name-height) + var(--mtime-height));
694696
--checkbox-padding: 0px;
695697
696698
display: grid;
697699
grid-template-columns: repeat(auto-fill, var(--row-width));
698-
grid-gap: 15px;
699-
row-gap: 15px;
700+
gap: 22px;
700701
701702
align-content: center;
702703
align-items: center;
703704
justify-content: space-around;
704705
justify-items: center;
706+
margin: 16px;
707+
width: calc(100% - 32px);
705708
706709
tr {
710+
display: flex;
711+
flex-direction: column;
707712
width: var(--row-width);
708-
height: calc(var(--row-height) + var(--clickable-area));
713+
height: var(--row-height);
709714
border: none;
710-
border-radius: var(--border-radius);
715+
padding: var(--item-padding);
716+
box-sizing: content-box
711717
}
712718
713719
// Checkbox in the top left
714720
.files-list__row-checkbox {
715721
position: absolute;
716722
z-index: 9;
717-
top: 0;
718-
left: 0;
723+
top: calc(var(--item-padding)/2);
724+
left: calc(var(--item-padding)/2);
719725
overflow: hidden;
720-
width: var(--clickable-area);
721-
height: var(--clickable-area);
722-
border-radius: var(--half-clickable-area);
726+
--checkbox-container-size: 44px;
727+
width: var(--checkbox-container-size);
728+
height: var(--checkbox-container-size);
729+
730+
// Add a background to the checkbox so we do not see the image through it.
731+
.checkbox-radio-switch__content::after {
732+
content: '';
733+
width: 16px;
734+
height: 16px;
735+
position: absolute;
736+
left: 14px;
737+
z-index: -1;
738+
background: var(--color-main-background);
739+
}
723740
}
724741
725742
// Star icon in the top right
@@ -735,36 +752,44 @@ tbody.files-list__tbody.files-list__tbody--grid {
735752
}
736753
737754
.files-list__row-name {
738-
display: grid;
739-
justify-content: stretch;
740-
width: 100%;
741-
height: 100%;
742-
grid-auto-rows: var(--row-height) var(--clickable-area);
755+
display: flex;
756+
flex-direction: column;
757+
width: var(--icon-preview-size);
758+
height: calc(var(--icon-preview-size) + var(--name-height));
759+
// Ensure that the name outline is visible.
760+
overflow: visible;
743761
744762
span.files-list__row-icon {
745-
width: 100%;
746-
height: 100%;
747-
// Visual balance, we use half of the clickable area
748-
// as a margin around the preview
749-
padding-top: var(--half-clickable-area);
763+
width: var(--icon-preview-size);
764+
height: var(--icon-preview-size);
765+
}
766+
767+
.files-list__row-icon-preview {
768+
border-radius: 0;
750769
}
751770
752771
a.files-list__row-name-link {
753-
// Minus action menu
754-
width: calc(100% - var(--clickable-area));
755-
height: var(--clickable-area);
772+
height: var(--name-height);
756773
}
757774
758775
.files-list__row-name-text {
759776
margin: 0;
760-
padding-right: 0;
777+
// Ensure that the outline is not too close to the text.
778+
margin-left: -4px;
779+
padding: 0px 4px;
761780
}
762781
}
763782
783+
.files-list__row-mtime {
784+
width: var(--icon-preview-size);
785+
height: var(--mtime-height);
786+
font-size: calc(var(--default-font-size) - 4px);
787+
}
788+
764789
.files-list__row-actions {
765790
position: absolute;
766-
right: 0;
767-
bottom: 0;
791+
right: calc(var(--half-clickable-area) / 2);
792+
bottom: calc(var(--mtime-height) / 2);
768793
width: var(--clickable-area);
769794
height: var(--clickable-area);
770795
}

apps/files/src/components/VirtualList.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ export default Vue.extend({
127127
128128
itemHeight() {
129129
// Align with css in FilesListVirtual
130-
// 138px + 44px (name) + 15px (grid gap)
131-
return this.gridMode ? (138 + 44 + 15) : 55
130+
// 208px + 32px (name) + 16px (mtime) + 16px (padding) + 22px (grid gap)
131+
return this.gridMode ? (208 + 32 + 16 + 16 + 22) : 55
132132
},
133133
// Grid mode only
134134
itemWidth() {
135-
// 160px + 15px grid gap
136-
return 160 + 15
135+
// 208px + 16px padding + 22px grid gap
136+
return 208 + 16 + 22
137137
},
138138
139139
rowCount() {

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)