Browse Source

Merge branch 'from/develop/tusooa/fix-overlap-button' into 'develop'

Fix overlapping buttons in Theme settings

See merge request pleroma/pleroma-fe!1488
HJ 2 years ago
parent
commit
fd77c583bf

+ 5 - 0
src/components/settings_modal/settings_modal.scss

@@ -54,5 +54,10 @@
     >* {
       margin-right: 0.5em;
     }
+
+    .extra-content {
+      display: flex;
+      flex-grow: 1;
+    }
   }
 }

+ 4 - 0
src/components/settings_modal/settings_modal.vue

@@ -112,6 +112,10 @@
         <Checkbox v-model="expertLevel">
           {{ $t("settings.expert_mode") }}
         </Checkbox>
+        <portal-target
+          class="extra-content"
+          name="unscrolled-content"
+        />
       </div>
     </div>
   </Modal>

+ 4 - 0
src/components/settings_modal/tabs/theme_tab/theme_tab.js

@@ -378,6 +378,10 @@ export default {
         // To separate from other random JSON files and possible future source formats
         _pleroma_theme_version: 2, theme, source
       }
+    },
+    isActive () {
+      const tabSwitcher = this.$parent
+      return tabSwitcher ? tabSwitcher.isActive('theme') : false
     }
   },
   components: {

+ 16 - 14
src/components/settings_modal/tabs/theme_tab/theme_tab.scss

@@ -268,13 +268,6 @@
     }
   }
 
-  .apply-container {
-    justify-content: center;
-    position: absolute;
-    bottom: 8px;
-    right: 5px;
-  }
-
   .radius-item,
   .color-item {
     min-width: 20em;
@@ -334,16 +327,25 @@
     padding: 20px;
   }
 
+  .btn {
+    margin-left: .25em;
+    margin-right: .25em;
+  }
+}
+
+.extra-content {
   .apply-container {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-around;
+    flex-grow: 1;
+
     .btn {
+      flex-grow: 1;
       min-height: 28px;
-      min-width: 10em;
-      padding: 0 2em;
+      min-width: 0;
+      max-width: 10em;
+      padding: 0;
     }
   }
-
-  .btn {
-    margin-left: .25em;
-    margin-right: .25em;
-  }
 }

+ 20 - 15
src/components/settings_modal/tabs/theme_tab/theme_tab.vue

@@ -1016,21 +1016,26 @@
       </tab-switcher>
     </keep-alive>
 
-    <div class="apply-container">
-      <button
-        class="btn button-default submit"
-        :disabled="!themeValid"
-        @click="setCustomTheme"
-      >
-        {{ $t('general.apply') }}
-      </button>
-      <button
-        class="btn button-default"
-        @click="clearAll"
-      >
-        {{ $t('settings.style.switcher.reset') }}
-      </button>
-    </div>
+    <portal
+      v-if="isActive"
+      to="unscrolled-content"
+    >
+      <div class="apply-container">
+        <button
+          class="btn button-default submit"
+          :disabled="!themeValid"
+          @click="setCustomTheme"
+        >
+          {{ $t('general.apply') }}
+        </button>
+        <button
+          class="btn button-default"
+          @click="clearAll"
+        >
+          {{ $t('settings.style.switcher.reset') }}
+        </button>
+      </div>
+    </portal>
   </div>
 </template>
 

+ 6 - 0
src/components/tab_switcher/tab_switcher.js

@@ -47,6 +47,12 @@ export default Vue.component('tab-switcher', {
         return this.active
       }
     },
+    isActive () {
+      return tabName => {
+        const isWanted = slot => slot.data && slot.data.attrs['data-tab-name'] === tabName
+        return this.$slots.default.findIndex(isWanted) === this.activeIndex
+      }
+    },
     settingsModalVisible () {
       return this.settingsModalState === 'visible'
     },