<template>
  <div class="pu-layout">
    <div class="pu-layout__header">
      <a
        class="pu-layout__brand"
        href="javascript:void(0)"
        @click="openHome"
      >
        <img
          :src="logo"
          class="pu-layout__logo"
          alt="logo"
        >
      </a>

      <div class="pu-layout__header-right">
        <span class="pu-layout__version">{{ configApp.verText }}</span>
      </div>
    </div>

    <div class="pu-layout__content">
      <notify-app from="popup" />
      <slot />
    </div>
  </div>
</template>

<script>
import { configApp, configLayout } from '@/config/app';

export default {
  name: 'LayoutPopup',
  data() {
    return {
      logo: configApp.logoWhite,
      layout: configLayout,
    };
  },
  methods: {
    openHome() {
      this.openExternalUrl(configApp.homePage);
    },
  },
};
</script>

<style lang="scss" scoped>
@import '@/vue/styles/tokens.scss';

.pu-layout {
  display: flex;
  flex-direction: column;
  width: 800px;
  height: 560px;
  overflow: hidden;
  background: $c-surface-soft;

  &__header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 16px;
    background: $c-surface-dark;
  }

  &__brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity $motion-fast;

    &:hover {
      opacity: 0.85;
    }
  }

  &__logo {
    height: 28px;
    object-fit: contain;
  }

  &__header-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  &__version {
    padding: 2px 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.08);
    border-radius: $radius-badge;
  }

  &__content {
    flex: 1;
    padding: 10px 12px;
    overflow-x: hidden;
    overflow-y: auto;

    @include scrollbar(4px);
  }
}
</style>

<style lang="scss">
@import '@/vue/styles/tokens.scss';

.ivu-select-dropdown {
  max-height: 300px;
}
</style>
