| 
 | 1 | +<template>  | 
 | 2 | +  <div>  | 
 | 3 | +    <header class="header">  | 
 | 4 | +      <h1 class="header-title">MeiliSearch + Vue InstantSearch</h1>  | 
 | 5 | +      <p class="header-subtitle">Search in Steam video games 🎮</p>  | 
 | 6 | +    </header>  | 
 | 7 | +    <p class="disclaimer">  | 
 | 8 | +      This is not the official Steam dataset but only for demo purpose.  | 
 | 9 | +      Enjoy searching with MeiliSearch!  | 
 | 10 | +    </p>  | 
 | 11 | +    <div class="container">  | 
 | 12 | +      <ais-instant-search :search-client="searchClient" index-name="steam-video-games">  | 
 | 13 | +        <div class="search-panel__filters">  | 
 | 14 | +          <ais-clear-refinements>  | 
 | 15 | +            <span slot="resetLabel">Clear all filters</span>  | 
 | 16 | +          </ais-clear-refinements>  | 
 | 17 | +          <h2>Genres</h2>  | 
 | 18 | +          <ais-refinement-list attribute="genres"/>  | 
 | 19 | +          <h2>Players</h2>  | 
 | 20 | +          <ais-refinement-list attribute="players"/>  | 
 | 21 | +          <h2>Platforms</h2>  | 
 | 22 | +          <ais-refinement-list attribute="platforms"/>  | 
 | 23 | +          <h2>Misc</h2>  | 
 | 24 | +          <ais-refinement-list attribute="misc"/>  | 
 | 25 | +        </div>  | 
 | 26 | + | 
 | 27 | +        <div class="search-panel__results">  | 
 | 28 | +          <ais-search-box placeholder="Search here…"/>  | 
 | 29 | + | 
 | 30 | +          <ais-hits>  | 
 | 31 | +            <template slot="item" slot-scope="{ item }">  | 
 | 32 | +              <div>  | 
 | 33 | +                <div class="hit-name">  | 
 | 34 | +                  <ais-highlight :hit="item" attribute="name"/>  | 
 | 35 | +                </div>  | 
 | 36 | +                <img :src="item.image" align="left" :alt="item.image">  | 
 | 37 | +                <div class="hit-info">price: {{item.price}}</div>  | 
 | 38 | +                <div class="hit-info">release date: {{item.releaseDate}}</div>  | 
 | 39 | +              </div>  | 
 | 40 | +            </template>  | 
 | 41 | +          </ais-hits>  | 
 | 42 | + | 
 | 43 | +          <ais-pagination/>  | 
 | 44 | +        </div>  | 
 | 45 | +      </ais-instant-search>  | 
 | 46 | +    </div>  | 
 | 47 | +  </div>  | 
 | 48 | +</template>  | 
 | 49 | + | 
 | 50 | +<script>  | 
 | 51 | +import "instantsearch.css/themes/algolia-min.css";  | 
 | 52 | +import instantMeiliSearch from "../../../src/index.js";  | 
 | 53 | +
  | 
 | 54 | +export default {  | 
 | 55 | +  data() {  | 
 | 56 | +    return {  | 
 | 57 | +      searchClient: instantMeiliSearch(  | 
 | 58 | +        "https://demos.meilisearch.com",  | 
 | 59 | +        "dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25"  | 
 | 60 | +      )  | 
 | 61 | +    };  | 
 | 62 | +  }  | 
 | 63 | +};  | 
 | 64 | +</script>  | 
 | 65 | + | 
 | 66 | +<style>  | 
 | 67 | +body,  | 
 | 68 | +h1 {  | 
 | 69 | +  margin: 0;  | 
 | 70 | +  padding: 0;  | 
 | 71 | +}  | 
 | 72 | +
  | 
 | 73 | +body {  | 
 | 74 | +  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,  | 
 | 75 | +    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";  | 
 | 76 | +}  | 
 | 77 | +
  | 
 | 78 | +.ais-Hits-item {  | 
 | 79 | +  margin-bottom: 1em;  | 
 | 80 | +  width: calc(50% - 1rem);  | 
 | 81 | +}  | 
 | 82 | +
  | 
 | 83 | +.ais-Hits-item img {  | 
 | 84 | +  margin-right: 1em;  | 
 | 85 | +  width: 100%;  | 
 | 86 | +  height: 100%;  | 
 | 87 | +  margin-bottom: 0.5em;  | 
 | 88 | +}  | 
 | 89 | +
  | 
 | 90 | +.ais-Highlight-highlighted {  | 
 | 91 | +  background: cyan;  | 
 | 92 | +  font-style: normal;  | 
 | 93 | +}  | 
 | 94 | +
  | 
 | 95 | +.disclaimer {  | 
 | 96 | +  margin-left: 1em;  | 
 | 97 | +}  | 
 | 98 | +
  | 
 | 99 | +.hit-name {  | 
 | 100 | +  margin-bottom: 0.5em;  | 
 | 101 | +}  | 
 | 102 | +
  | 
 | 103 | +.hit-info {  | 
 | 104 | +  font-size: 90%;  | 
 | 105 | +}  | 
 | 106 | +
  | 
 | 107 | +.header {  | 
 | 108 | +  display: flex;  | 
 | 109 | +  align-items: center;  | 
 | 110 | +  min-height: 50px;  | 
 | 111 | +  padding: 0.5rem 1rem;  | 
 | 112 | +  background-image: linear-gradient(to right, #4dba87, #2f9088);  | 
 | 113 | +  color: #fff;  | 
 | 114 | +  margin-bottom: 1rem;  | 
 | 115 | +}  | 
 | 116 | +
  | 
 | 117 | +.header-title {  | 
 | 118 | +  font-size: 1.2rem;  | 
 | 119 | +  font-weight: normal;  | 
 | 120 | +}  | 
 | 121 | +
  | 
 | 122 | +.header-title::after {  | 
 | 123 | +  content: " ▸ ";  | 
 | 124 | +  padding: 0 0.5rem;  | 
 | 125 | +}  | 
 | 126 | +
  | 
 | 127 | +.header-subtitle {  | 
 | 128 | +  font-size: 1.2rem;  | 
 | 129 | +}  | 
 | 130 | +
  | 
 | 131 | +.container {  | 
 | 132 | +  padding: 1rem;  | 
 | 133 | +}  | 
 | 134 | +
  | 
 | 135 | +.ais-InstantSearch {  | 
 | 136 | +  max-width: 960px;  | 
 | 137 | +  overflow: hidden;  | 
 | 138 | +  margin: 0;  | 
 | 139 | +}  | 
 | 140 | +
  | 
 | 141 | +.search-panel__filters {  | 
 | 142 | +  float: left;  | 
 | 143 | +  width: 200px;  | 
 | 144 | +}  | 
 | 145 | +
  | 
 | 146 | +.search-panel__results {  | 
 | 147 | +  margin-left: 210px;  | 
 | 148 | +}  | 
 | 149 | +
  | 
 | 150 | +.ais-SearchBox {  | 
 | 151 | +  margin-bottom: 2rem;  | 
 | 152 | +}  | 
 | 153 | +
  | 
 | 154 | +.ais-Pagination {  | 
 | 155 | +  margin: 2rem auto;  | 
 | 156 | +  text-align: center;  | 
 | 157 | +}  | 
 | 158 | +</style>  | 
0 commit comments