Home.vue 3.9 KB

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