Skip to content

Commit 928b3b3

Browse files
authored
Merge pull request #38174 from nextcloud/enh/template-picker
feat: Enhance template picker size and layout depending on aspect ratio
2 parents 1085598 + 032e3d3 commit 928b3b3

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

apps/files/src/views/TemplatePicker.vue

Lines changed: 7 additions & 6 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"
@@ -47,9 +47,6 @@
4747

4848
<!-- Cancel and submit -->
4949
<div class="templates-picker__buttons">
50-
<button @click="close">
51-
{{ t('files', 'Cancel') }}
52-
</button>
5350
<input type="submit"
5451
class="primary"
5552
:value="t('files', 'Create')"
@@ -75,7 +72,6 @@ import TemplatePreview from '../components/TemplatePreview.vue'
7572
7673
const border = 2
7774
const margin = 8
78-
const width = margin * 20
7975
8076
export default {
8177
name: 'TemplatePicker',
@@ -136,6 +132,11 @@ export default {
136132
* @return {object}
137133
*/
138134
style() {
135+
// Fallback to 16:9 landscape ratio
136+
const ratio = this.provider.ratio ? this.provider.ratio : 1.77
137+
// Landscape templates should be wider than tall ones
138+
// We fit 3 templates per row at max for landscape and 4 for portrait
139+
const width = ratio > 1 ? margin * 30 : margin * 20
139140
return {
140141
'--margin': margin + 'px',
141142
'--width': width + 'px',
@@ -275,7 +276,7 @@ export default {
275276
276277
&__buttons {
277278
display: flex;
278-
justify-content: space-between;
279+
justify-content: end;
279280
padding: calc(var(--margin) * 2) var(--margin);
280281
position: sticky;
281282
bottom: 0;

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)