Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

1.6 KB
Raw Blame
<!-- Main homepage for default view -->
<template>
  <div class="add-section" :style="dynamicStyle">
  <!-- When in edit mode, show Add New Section button -->
  <div v-if="isEditMode" @click="openAddNewSectionMenu()" class="add-new-section">
    <p>βž• {{ $t('interactive-editor.edit-section.add-section-title') }}</p>
  </div>
  <!-- Add new section form -->
  <EditSectionMenu
    v-if="isEditMode && addNewSectionOpen"
    :isAddNew="true"
    @closeEditSection="closeEditSection"
  />
  </div>
</template>

<script>

import EditSectionMenu from '@/components/InteractiveEditor/EditSection.vue';
import MasonryItem from '@/mixins/MasonryItem';
import StoreKeys from '@/utils/StoreMutations';

export default {
  name: 'add-section-container',
  mixins: [MasonryItem],
  components: {
    EditSectionMenu,
  },
  data: () => ({
    addNewSectionOpen: false,
  }),
  computed: {
    isEditMode() {
      return this.$store.state.editMode;
    },
    dynamicStyle() {
      return this.masonryStyle;
    },
  },
  methods: {
    openAddNewSectionMenu() {
      this.addNewSectionOpen = true;
      this.$store.commit(StoreKeys.SET_MODAL_OPEN, true);
    },
    closeEditSection() {
      this.addNewSectionOpen = false;
    },
  },
};
</script>

<style lang="scss" scoped>

.add-new-section {
  border: 2px dashed var(--primary);
  border-radius: var(--curve-factor);
  padding: var(--item-group-padding);
  background: var(--item-group-background);
  color: var(--primary);
  font-size: 1.2rem;
  cursor: pointer;
  text-align: center;
  height: fit-content;
  margin: 10px;
  min-width: 250px;
}

</style>