source.vue 1.76 KB
Newer Older
1 2 3 4 5
<template lang='pug'>
  v-app(:dark='darkMode').source
    nav-header
    v-content
      v-toolbar(color='primary', dark)
6
        i18next.subheading(path='common:page.viewingSource', tag='div')
Nick's avatar
Nick committed
7
          strong(place='path') /{{path}}
8 9
        template(v-if='$vuetify.breakpoint.mdAndUp')
          v-spacer
10 11
          .caption.blue--text.text--lighten-3 {{$t('common:page.id', { id: pageId })}}
          v-btn.ml-4(depressed, color='blue darken-1', @click='goLive') {{$t('common:page.returnNormalView')}}
12 13
      v-card(tile)
        v-card-text
14
          v-card.grey.radius-7(flat, :class='darkMode ? `darken-4` : `lighten-4`')
15 16 17 18 19 20
            v-card-text
              pre
                code
                  slot

    nav-footer
21
    notify
22
    search-results
23 24 25
</template>

<script>
26
import { get } from 'vuex-pathify'
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

export default {
  props: {
    pageId: {
      type: Number,
      default: 0
    },
    locale: {
      type: String,
      default: 'en'
    },
    path: {
      type: String,
      default: 'home'
    }
  },
  data() {
    return {}
  },
  computed: {
47
    darkMode: get('site/dark')
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
  },
  created () {
    this.$store.commit('page/SET_ID', this.id)
    this.$store.commit('page/SET_LOCALE', this.locale)
    this.$store.commit('page/SET_PATH', this.path)

    this.$store.commit('page/SET_MODE', 'history')
  },
  methods: {
    goLive() {
      window.location.assign(`/${this.path}`)
    }
  }
}
</script>

<style lang='scss'>

.source {
  pre > code {
    box-shadow: none;
    color: mc('grey', '800');
Nick's avatar
Nick committed
70
    font-family: 'Roboto Mono', sans-serif;
71 72 73
    font-weight: 400;
    font-size: 1rem;

74 75 76 77 78
    @at-root .theme--dark.source pre > code {
      background-color: mc('grey', '900');
      color: mc('grey', '400');
    }

79 80 81 82 83 84 85
    &::before {
      display: none;
    }
  }
}

</style>