Home.vue 3.9 KB

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