<!--

 This file is part of the Meeds project (https://meeds.io/).

 Copyright (C) 2020 - 2023 Meeds Association contact@meeds.io

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 3 of the License, or (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

-->
<template>
  <v-row class="ma-0 position-relative">
    <v-col
      cols="12"
      lg="6"
      class="pa-0 mb-12 pb-5">
      <portal-general-settings-branding-site 
        :branding="branding"
        :custom-css="customStylesheet"
        @changed="$emit('changed')"
        @saved="$emit('saved')"
        @close="$emit('close')" />
    </v-col>
    <v-col
      cols="12"
      lg="6"
      class="pa-0">
      <portal-general-settings-branding-site-preview />
      <portal-general-settings-custom-style-input
        v-if="customStylesheetEnabled"
        v-model="customStylesheet"
        class="mt-8" />
    </v-col>
  </v-row>
</template>
<script>
export default {
  props: {
    branding: {
      type: Object,
      default: null,
    },
  },
  data: () => ({
    customStylesheetEnabled: eXo.env.portal.customStylesheetEnabled,
    customStylesheet: null,
  }),
  watch: {
    customStylesheet() {
      this.$emit('changed');
    },
  },
  created() {
    this.customStylesheet = this.branding?.customCss;
  },
};
</script>
