Skip to content
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

UX refinements #8

Merged
merged 13 commits into from
Aug 29, 2023
13 changes: 6 additions & 7 deletions i18n/en.json
Original file line number Original file line Diff line number Diff line change
@@ -1,16 +1,15 @@
{ {
"export": "Export", "export": "Download {{ type }}",
"exported": "Exported {{ count }} {{ type }}", "exported": "Downloaded {{ count }} {{ type }}",
"exporting": "Exporting {{ type }}...", "exporting": "Downloading {{ type }}...",
"exportModalDescription": "You've selected {{ count }} {{ type }} for export", "exportModalDescription": "You've selected {{ count }} {{ type }} for download",
"exportModalRelatedDocumentDescription": "Include the following document types where applicable", "exportModalRelatedDocumentDescription": "Include the following document types where applicable",
"exportModalSettingsLabel": "Export Settings", "exportModalSettingsLabel": "Export Settings",
"exportModalDocumentFormat": "Document Format", "exportModalDocumentFormat": "Document Format",
"exportModalIncludeRelated": "Include related documents", "exportModalIncludeRelated": "Include related documents",
"exportModalIncludeChildren": "Include children of this page", "exportModalIncludeChildren": "Include children of this page",
"exportModalIncludeRelatedSettings": "Related Documents Settings", "exportModalIncludeRelatedSettings": "Related Documents Settings",
"exportModalNoRelatedTypes": "No Related Types", "exportModalNoRelatedTypes": "No Related Types",
"import": "Import", "import": "Upload {{ type }}",
"importDocuments": "Import Documents", "importModalDescription": "Uploading content requires a zip file. See our <a href=\"https://v3.docs.apostrophecms.org/\" target=\"_blank\">guide to importing content</a> in Apostrophe."
"importModalDescription": "Importing content requires a zip file. See our <a href=\"https://v3.docs.apostrophecms.org/\" target=\"_blank\">guide to importing content</a> in Apostrophe."
} }
77 changes: 69 additions & 8 deletions ui/apos/components/AposExportModal.vue
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AposModalBody> <AposModalBody>
<template #bodyMain> <template #bodyMain>
<h2 class="apos-export__heading"> <h2 class="apos-export__heading">
{{ $t('aposImportExport:export') }} {{ moduleLabel }} {{ $t('aposImportExport:export', { type: moduleLabel }) }}
</h2> </h2>
<p <p
class="apos-export__description" class="apos-export__description"
Expand Down Expand Up @@ -57,9 +57,17 @@
</div> </div>
</div> </div>


<transition
name="fade"
:duration="200"
>
<div <div
v-show="!relatedDocumentsDisabled" v-show="!relatedDocumentsDisabled"
class="apos-export__section" class="apos-export__section"
>
<div
ref="container"
class="apos-export__section-container"
> >
<div class="apos-export__settings"> <div class="apos-export__settings">
{{ $t('aposImportExport:exportModalIncludeRelatedSettings') }} {{ $t('aposImportExport:exportModalIncludeRelatedSettings') }}
Expand All @@ -69,7 +77,10 @@
<div class="apos-export__related-description"> <div class="apos-export__related-description">
{{ $t('aposImportExport:exportModalRelatedDocumentDescription') }} {{ $t('aposImportExport:exportModalRelatedDocumentDescription') }}
</div> </div>
<div v-if="relatedTypes && relatedTypes.length"> <div
v-if="relatedTypes && relatedTypes.length"
class="apos-export__related-list"
>
<AposCheckbox <AposCheckbox
v-for="relatedType in relatedTypes" v-for="relatedType in relatedTypes"
:key="relatedType" :key="relatedType"
Expand All @@ -91,6 +102,8 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</transition>


<div class="apos-export__separator apos-export__separator--full-width" /> <div class="apos-export__separator apos-export__separator--full-width" />


Expand All @@ -104,7 +117,7 @@
ref="exportDocs" ref="exportDocs"
icon="apos-import-export-download-icon" icon="apos-import-export-download-icon"
class="apos-export__btn" class="apos-export__btn"
label="aposImportExport:export" :label="$t('aposImportExport:export', { type: moduleLabel })"
type="primary" type="primary"
@click="exportDocs" @click="exportDocs"
/> />
Expand All @@ -116,6 +129,10 @@
</template> </template>


<script> <script>
const CONTAINER_ITEM_HEIGHT = 24;
const CONTAINER_DESCRIPTION_HEIGHT = 95;
falkodev marked this conversation as resolved.
Show resolved Hide resolved
const CONTAINER_MINIMUM_HEIGHT = 120;

export default { export default {
props: { props: {
moduleName: { moduleName: {
Expand All @@ -142,6 +159,7 @@ export default {
return { return {
modal: { modal: {
active: false, active: false,
type: 'overlay',
showModal: false, showModal: false,
disableHeader: true disableHeader: true
}, },
Expand Down Expand Up @@ -229,6 +247,9 @@ export default {
type: this.type type: this.type
} }
}); });
this.checkedRelatedTypes = this.relatedTypes;
const height = this.checkedRelatedTypes.length ? this.checkedRelatedTypes.length * CONTAINER_ITEM_HEIGHT + CONTAINER_DESCRIPTION_HEIGHT : CONTAINER_MINIMUM_HEIGHT;
this.$refs.container.style.setProperty('--container-height', `${height}px`);
} }
}, },
toggleRelatedChildren() { toggleRelatedChildren() {
Expand Down Expand Up @@ -281,8 +302,8 @@ export default {
} }


::v-deep .apos-modal__body { ::v-deep .apos-modal__body {
padding: 20px 30px; padding: 30px 20px;
width: 335px; width: 375px;
} }


::v-deep .apos-modal__body-main { ::v-deep .apos-modal__body-main {
Expand All @@ -295,6 +316,10 @@ export default {
display: flex; display: flex;
} }


::v-deep .apos-input--select {
text-transform: capitalize;
}

.apos-export__heading { .apos-export__heading {
@include type-title; @include type-title;
line-height: var(--a-line-tall); line-height: var(--a-line-tall);
Expand All @@ -307,6 +332,7 @@ export default {
font-size: var(--a-type-large); font-size: var(--a-type-large);
text-align: left; text-align: left;
line-height: var(--a-line-tallest); line-height: var(--a-line-tallest);
margin-top: 5px;
} }


.apos-export__section { .apos-export__section {
Expand All @@ -317,6 +343,10 @@ export default {
min-width: 100%; min-width: 100%;
} }


.apos-export__section-container {
overflow: hidden;
}

.apos-export__settings { .apos-export__settings {
@include type-base; @include type-base;
font-weight: 600; font-weight: 600;
Expand All @@ -343,16 +373,16 @@ export default {
} }


.apos-export__separator { .apos-export__separator {
background-color: var(--a-base-8); background-color: var(--a-base-9);
position: relative; position: relative;
height: 1px; height: 1px;
width: 100%; width: calc(100% - 10px);
margin: 10px 0; margin: 10px 0;
} }


.apos-export__separator--full-width::before { .apos-export__separator--full-width::before {
content: ""; content: "";
background-color: var(--a-base-8); background-color: var(--a-base-9);
position: absolute; position: absolute;
height: 100%; height: 100%;
width: calc(100% + 60px); width: calc(100% + 60px);
Expand All @@ -371,4 +401,35 @@ export default {
width: 100%; width: 100%;
gap: 20px; gap: 20px;
} }

.apos-export__btn ::v-deep .apos-button__label {
text-transform: capitalize;
}

.apos-export__related-list {
max-height: 210px;
overflow-y: overlay;
width: 100%;
}

.fade-enter-active {
.apos-export__section-container {
animation: expand .3s;
}
}
.fade-leave-active {
.apos-export__section-container {
animation: expand .3s reverse;
}
}

@keyframes expand {
0% {
height: 0;
}

100% {
height: var(--container-height);
}
}
</style> </style>
42 changes: 40 additions & 2 deletions ui/apos/components/AposImportModal.vue
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AposModalBody> <AposModalBody>
<template #bodyMain> <template #bodyMain>
<h2 class="apos-import__heading"> <h2 class="apos-import__heading">
{{ $t('aposImportExport:importDocuments') }} {{ $t('aposImportExport:import', { type: $t(labels.plural) }) }}
</h2> </h2>
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<p <p
Expand All @@ -26,6 +26,9 @@
@upload-file="uploadImportFile" @upload-file="uploadImportFile"
@update="updateImportFile" @update="updateImportFile"
/> />

<div class="apos-import__separator" />

<div class="apos-import__btns"> <div class="apos-import__btns">
<AposButton <AposButton
ref="cancelButton" ref="cancelButton"
Expand All @@ -36,7 +39,7 @@
<AposButton <AposButton
class="apos-import__btn" class="apos-import__btn"
icon="apos-import-export-upload-icon" icon="apos-import-export-upload-icon"
label="aposImportExport:import" :label="$t('aposImportExport:import', { type: $t(labels.plural) })"
type="primary" type="primary"
:disabled="!selectedFile" :disabled="!selectedFile"
@click="runImport" @click="runImport"
Expand All @@ -50,7 +53,18 @@


<script> <script>
export default { export default {

props: {
labels: {
type: Object,
default: () => ({
singular: '',
plural: ''
})
}
},
emits: [ 'safe-close' ], emits: [ 'safe-close' ],

data () { data () {
return { return {
modal: { modal: {
Expand All @@ -62,9 +76,11 @@ export default {
selectedFile: null selectedFile: null
}; };
}, },

mounted() { mounted() {
this.modal.active = true; this.modal.active = true;
}, },

methods: { methods: {
ready() { ready() {
this.$refs.cancelButton.$el.querySelector('button').focus(); this.$refs.cancelButton.$el.querySelector('button').focus();
Expand Down Expand Up @@ -115,6 +131,24 @@ export default {
min-width: 370px; min-width: 370px;
} }


&__separator {
background-color: var(--a-base-9);
position: relative;
height: 1px;
width: calc(100% - 10px);
margin: 10px 0;

&::before {
content: "";
background-color: var(--a-base-9);
position: absolute;
height: 100%;
width: calc(100% + 60px);
left: -30px;
right: 0;
}
}

&__btns { &__btns {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
Expand Down Expand Up @@ -145,6 +179,10 @@ export default {
flex-direction: column; flex-direction: column;
align-items: baseline; align-items: baseline;
} }

.apos-modal__body {
padding: 30px 20px;
}
} }


</style> </style>