Skip to content

Commit 0ca8742

Browse files
committed
feat: Enhance template picker size and layout depending on aspect ratio
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 1584051 commit 0ca8742

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/files/src/views/TemplatePicker.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<NcModal v-if="opened"
2525
:clear-view-delay="-1"
2626
class="templates-picker"
27-
size="normal"
27+
size="large"
2828
@close="close">
2929
<form class="templates-picker__form"
3030
:style="style"
@@ -75,7 +75,6 @@ import TemplatePreview from '../components/TemplatePreview.vue'
7575
7676
const border = 2
7777
const margin = 8
78-
const width = margin * 20
7978
8079
export default {
8180
name: 'TemplatePicker',
@@ -136,6 +135,11 @@ export default {
136135
* @return {object}
137136
*/
138137
style() {
138+
// Fallback to 16:9 landscape ratio
139+
const ratio = this.provider.ratio ? this.provider.ratio : 1.77
140+
// Landscape templates should be wider than tall ones
141+
// We fit 3 templates per row at max for landscape and 4 for portrait
142+
const width = ratio > 1 ? margin * 30 : margin * 20
139143
return {
140144
'--margin': margin + 'px',
141145
'--width': width + 'px',

0 commit comments

Comments
 (0)