Home.vue 6.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<template>
  <main
    :aria-labelledby="$frontmatter.heroText !== null ? 'main-title' : null"
    class="home"
  >
    <header class="hero">
      <MyTransition>
        <img
          v-if="$frontmatter.heroImage"
          key="light"
          :class="{ light: Boolean($frontmatter.darkHeroImage) }"
          :src="$withBase($frontmatter.heroImage)"
          :alt="$frontmatter.heroAlt || 'HomeLogo'"
        />
      </MyTransition>
      <MyTransition>
        <img
          v-if="$frontmatter.darkHeroImage"
          key="dark"
          class="dark"
          :src="$withBase($frontmatter.darkHeroImage)"
          :alt="$frontmatter.heroAlt || 'HomeLogo'"
        />
      </MyTransition>
      <div class="hero-info">
        <MyTransition :delay="0.04">
          <h1
            v-if="$frontmatter.heroText !== false"
            id="main-title"
            v-text="$frontmatter.heroText || $title || 'Hello'"
          />
        </MyTransition>
        <MyTransition :delay="0.08">
          <p
            class="description"
            v-text="
              $frontmatter.tagline ||
              $description ||
              'Welcome to your VuePress site'
            "
          />
        </MyTransition>
        <MyTransition :delay="0.12">
          <p v-if="$frontmatter.action" class="action">
            <NavLink
              v-for="action in actionLinks"
              :key="action.text"
              :item="action"
              class="action-button"
              :class="action.type || ''"
            />
          </p>
        </MyTransition>
      </div>
    </header>
56
 
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294

    <MyTransition :delay="0.16">
      <div>
        <h2 class="features-header">Resources</h2>
        <div
          v-if="$frontmatter.features && $frontmatter.features.length"
          class="features"
        >
          <template v-for="(feature, index) in $frontmatter.features">
            <div
              v-if="feature.link"
              :key="index"
              class="feature link"
              :class="`feature${index % 9}`"
              tabindex="0"
              role="navigation"
              @click="navigate(feature.link)"
            >
              <div class="icon-container">
                <i :class="`far fa-${feature.icon}`"></i>
              </div>
              <h2>{{ feature.title }}</h2>
              <p>{{ feature.details }}</p>
            </div>
            <div
              v-else
              :key="index"
              class="feature"
              :class="`feature${index % 9}`"
            >
              <h2>{{ feature.title }}</h2>
              <p>{{ feature.details }}</p>
            </div>
          </template>
        </div>
      </div>
    </MyTransition>

    <MyTransition :delay="0.24">
      <Content class="theme-default-content custom" />
    </MyTransition>
  </main>
</template>

<script src="./Home" />

<style lang="stylus">
.home
  display block
  max-width $homePageWidth
  min-height 100vh - $navbarHeight
  padding $navbarHeight 2rem 0
  margin 0px auto
  overflow-x hidden

  @media (max-width $MQNarrow)
    min-height 100vh - $navbarMobileHeight
    padding-top $navbarMobileHeight

  @media (max-width $MQMobileNarrow)
    padding-left 1.5rem
    padding-right 1.5rem

  .hero
    text-align center

    @media (min-width $MQNarrow)
      display flex
      justify-content space-evenly
      align-items center
      text-align left

    img
      display block
      max-width 100%
      max-height 320px
      margin 0

      @media (max-width $MQNarrow)
        max-height 280px
        margin 3rem auto 1.5rem

      @media (max-width $MQMobile)
        max-height 240px
        margin 2rem auto 1.2rem

      @media (max-width $MQMobileNarrow)
        max-height 210px
        margin 1.5rem auto 1rem

      .theme-light &
        &.light
          display block

        &.dark
          display none

      .theme-dark &
        &.light
          display none

        &.dark
          display block

    h1
      font-size 3rem

      @media (max-width $MQMobile)
        font-size 2.5rem

      @media (max-width $MQMobileNarrow)
        font-size 2rem

    h1, .description, .action
      margin 1.8rem auto

      @media (max-width $MQMobile)
        margin 1.5rem auto

      @media (max-width $MQMobileNarrow)
        margin 1.2rem auto

    .description
      max-width 35rem
      color var(--text-color-l40)
      font-size 1.6rem
      line-height 1.3

      @media (max-width $MQMobile)
        font-size 1.4rem

      @media (max-width $MQMobileNarrow)
        font-size 1.2rem

    .action-button
      display inline-block
      margin 0.6rem 0.8rem
      padding 1rem 1.5rem
      border 2px solid var(--accent-color)
      border-radius 2rem
      color var(--accent-color)
      font-size 1.2rem
      transition background 0.1s ease
      overflow hidden

      @media (max-width $MQMobile)
        padding 0.8rem 1.2rem
        font-size 1.1rem

      @media (max-width $MQMobileNarrow)
        font-size 1rem

      &:hover
        color var(--white)
        background-color var(--accent-color)

      &.primary
        color var(--white)
        background-color var(--accent-color)

        &:hover
          border-color var(--accent-color-l10)
          background-color var(--accent-color-l10)

        .theme-dark &
          &:hover
            border-color var(--accent-color-d10)
            background-color var(--accent-color-d10)

  .features
    display flex
    flex-wrap wrap
    justify-content center
    align-items stretch
    align-content stretch
    margin 0 -2rem
    padding 1.2rem 0
    border-top 1px solid var(--border-color)

    @media (max-width $MQMobileNarrow)
      margin 0 -1.5rem

    .feature
      display flex
      flex-direction column
      justify-content center
      flex-basis calc(33% - 4rem)
      margin 0.5rem
      padding 0 1.5rem
      border-radius 0.5rem
      transition transform 0.3s, box-shadow 0.3s
      overflow hidden

      @media (max-width $MQNarrow)
        flex-basis calc(50% - 4rem)

      @media (max-width $MQMobile)
        font-size 0.95rem

      @media (max-width $MQMobileNarrow)
        flex-basis calc(100%)
        font-size 0.9rem
        margin 0.5rem 0
        border-radius 0

      &.link
        cursor pointer

      &:hover
        box-shadow 0 2px 12px 0 var(--card-shadow-color)

      h2
        margin-bottom 0.25rem
        border-bottom none
        color var(--text-color-l10)
        font-size 1.25rem
        font-weight 500

        @media (max-width $MQMobileNarrow)
          font-size 1.2rem

      p
        margin-top 0
        color var(--text-color-l25)

  {$contentClass}
    padding-bottom 1.5rem

@require '~@mr-hope/vuepress-shared/styles/colors.styl'

for $color, $index in $colors
  .home .features .feature{$index}
    &, .theme-light &
      background lighten($color, 90%)

    .theme-dark &
      background darken($color, 75%)
</style>