Home.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <main class="home" aria-labelledby="main-title">
  3. <header class="hero">
  4. <img
  5. v-if="data.heroImage"
  6. :src="$withBase(data.heroImage)"
  7. :alt="data.heroAlt || 'hero'"
  8. >
  9. <h1 v-if="data.heroText !== null" id="main-title">{{ data.heroText || $title || 'Hello' }}</h1>
  10. <p class="description">
  11. {{ data.tagline || $description || 'Welcome to your VuePress site' }}
  12. </p>
  13. <p
  14. class="action"
  15. v-if="data.actionText && data.actionLink"
  16. >
  17. <NavLink
  18. class="action-button"
  19. :item="actionLink"
  20. />
  21. </p>
  22. </header>
  23. <div
  24. class="features"
  25. v-if="data.features && data.features.length"
  26. >
  27. <div
  28. class="feature"
  29. v-for="(feature, index) in data.features"
  30. :key="index"
  31. >
  32. <h2>{{ feature.title }}</h2>
  33. <p>{{ feature.details }}</p>
  34. </div>
  35. </div>
  36. <Content class="theme-default-content custom"/>
  37. <div
  38. class="footer"
  39. v-if="data.footer"
  40. >
  41. {{ data.footer }}
  42. </div>
  43. </main>
  44. </template>
  45. <script>
  46. import NavLink from '@theme/components/NavLink.vue'
  47. export default {
  48. components: { NavLink },
  49. computed: {
  50. data () {
  51. return this.$page.frontmatter
  52. },
  53. actionLink () {
  54. return {
  55. link: this.data.actionLink,
  56. text: this.data.actionText
  57. }
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="stylus">
  63. .home
  64. padding $navbarHeight 2rem 0
  65. max-width 960px
  66. margin 0px auto
  67. display block
  68. .hero
  69. text-align center
  70. img
  71. max-width: 100%
  72. max-height 280px
  73. display block
  74. margin 3rem auto 1.5rem
  75. h1
  76. font-size 3rem
  77. h1, .description, .action
  78. margin 1.8rem auto
  79. .description
  80. max-width 35rem
  81. font-size 1.6rem
  82. line-height 1.3
  83. color lighten($textColor, 40%)
  84. .action-button
  85. display inline-block
  86. font-size 1.2rem
  87. color #fff
  88. background-color $accentColor
  89. padding 0.8rem 1.6rem
  90. border-radius 4px
  91. transition background-color .1s ease
  92. box-sizing border-box
  93. border-bottom 1px solid darken($accentColor, 10%)
  94. &:hover
  95. background-color lighten($accentColor, 10%)
  96. .features
  97. border-top 1px solid $borderColor
  98. padding 1.2rem 0
  99. margin-top 2.5rem
  100. display flex
  101. flex-wrap wrap
  102. align-items flex-start
  103. align-content stretch
  104. justify-content space-between
  105. .feature
  106. flex-grow 1
  107. flex-basis 30%
  108. max-width 30%
  109. h2
  110. font-size 1.4rem
  111. font-weight 500
  112. border-bottom none
  113. padding-bottom 0
  114. color lighten($textColor, 10%)
  115. p
  116. color lighten($textColor, 25%)
  117. .footer
  118. padding 2.5rem
  119. border-top 1px solid $borderColor
  120. text-align center
  121. color lighten($textColor, 25%)
  122. @media (max-width: $MQMobile)
  123. .home
  124. .features
  125. flex-direction column
  126. .feature
  127. max-width 100%
  128. padding 0 2.5rem
  129. @media (max-width: $MQMobileNarrow)
  130. .home
  131. padding-left 1.5rem
  132. padding-right 1.5rem
  133. .hero
  134. img
  135. max-height 210px
  136. margin 2rem auto 1.2rem
  137. h1
  138. font-size 2rem
  139. h1, .description, .action
  140. margin 1.2rem auto
  141. .description
  142. font-size 1.2rem
  143. .action-button
  144. font-size 1rem
  145. padding 0.6rem 1.2rem
  146. .feature
  147. h2
  148. font-size 1.25rem
  149. </style>