<template>
  <main>
    <header>
      <div>
        logo
      </div>
      <div>
        <span>
          click the map, or&nbsp;
          <button class="btn btn--primary" @click="showPicker">
            search
          </button>
        </span>
      </div>
    </header>
    <Map />
    <aside class="nav">
      <PickerOrigin v-show="isPickerVisible" :testlist="mountains" />
    </aside>
  </main>
</template>

<script>
import PickerOrigin from '../components/PickerOrigin.vue'
export default {
  components: { PickerOrigin },
  data () {
    return {
      mountains: [
        {
          slug: 'sluggy',
          title: 'titly'
        }
      ],
      isPickerVisible: false
    }
  },
  async fetch () {
    this.mountains = await fetch(
      'https://api.nuxtjs.dev/mountains'
    ).then(res => res.json())
  },
  methods: {
    showPicker () {
      this.isPickerVisible = !this.isPickerVisible
    }
  }
}
</script>

<style scoped>

header {
  position: fixed;
  top: 0;
  width: 100vw;
  z-index: 402;
  display: flex;
  flex-direction: row;
  padding: 1rem;
}

.nav {
  position: fixed;
  top: 0;
  padding-top: 4rem;
  width: 100vw;
  z-index: 401;
  background: white;
  display: flex;
  flex-direction: column;
  justify-items: center;
}

.btn--nav-open {
  padding: 1rem;
  display: block;
}

</style>
