-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Guillaume Chau
committed
Mar 12, 2018
1 parent
088d316
commit 83939c9
Showing
17 changed files
with
725 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions
67
packages/@vue/cli-ui/src/components/InstantSearchInput.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<div class="instant-search-input"> | ||
<VueInput | ||
icon-left="search" | ||
v-model="query" | ||
class="big" | ||
placeholder="Search a plugin" | ||
> | ||
<template slot="right"> | ||
<VueButton | ||
class="icon-button flat" | ||
icon-left="clear" | ||
@click="clear()" | ||
/> | ||
</template> | ||
</VueInput> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { Component } from 'vue-instantsearch' | ||
export default { | ||
mixins: [ | ||
Component | ||
], | ||
computed: { | ||
query: { | ||
get() { | ||
return this.searchStore.query | ||
}, | ||
set (value) { | ||
this.searchStore.stop() | ||
this.searchStore.query = value | ||
this.$emit('query', value) | ||
// We here ensure we give the time to listeners to alter the store's state | ||
// without triggering in between ghost queries. | ||
this.$nextTick(() => { | ||
this.searchStore.start() | ||
this.searchStore.refresh() | ||
}) | ||
} | ||
} | ||
}, | ||
methods: { | ||
clear () { | ||
this.searchStore.stop() | ||
if (this.searchStore.query.length > 0) { | ||
this.searchStore.query = '' | ||
} | ||
if (this.searchStore.activeRefinements.length > 0) { | ||
this.searchStore.clearRefinements() | ||
} | ||
this.searchStore.start() | ||
this.searchStore.refresh() | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="stylus" scoped> | ||
.instant-search-input | ||
.vue-input | ||
width 100% | ||
</style> |
67 changes: 67 additions & 0 deletions
67
packages/@vue/cli-ui/src/components/InstantSearchPagination.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<div | ||
v-show="totalResults > 0" | ||
class="instant-search-pagination" | ||
> | ||
<div class="content"> | ||
<VueButton | ||
class="icon-button" | ||
icon-left="first_page" | ||
:disabled="page === 1" | ||
@click="goToFirstPage()" | ||
/> | ||
|
||
<VueButton | ||
class="icon-button" | ||
icon-left="chevron_left" | ||
:disabled="page === 1" | ||
@click="goToPreviousPage()" | ||
/> | ||
|
||
<VueButton | ||
v-for="item in pages" | ||
:key="item" | ||
class="icon-button" | ||
:class="{ | ||
primary: page === item | ||
}" | ||
:label="item.toString()" | ||
@click="goToPage(item)" | ||
/> | ||
|
||
<VueButton | ||
class="icon-button" | ||
icon-left="chevron_right" | ||
:disabled="page >= totalPages" | ||
@click="goToNextPage()" | ||
/> | ||
|
||
<VueButton | ||
class="icon-button" | ||
icon-left="last_page" | ||
:disabled="page >= totalPages" | ||
@click="goToLastPage()" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { Pagination } from 'vue-instantsearch' | ||
export default { | ||
extends: Pagination | ||
} | ||
</script> | ||
|
||
<style lang="stylus" scoped> | ||
@import "~@/style/imports" | ||
.instant-search-pagination | ||
.content | ||
h-box() | ||
box-center() | ||
> .vue-button | ||
space-between-x(6px) | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<template> | ||
<div | ||
class="item-logo" | ||
:class="{ | ||
selected, | ||
loaded | ||
}" | ||
> | ||
<div class="wrapper"> | ||
<VueIcon | ||
v-if="selected" | ||
icon="done" | ||
/> | ||
<img | ||
v-else-if="image" | ||
class="image" | ||
:src="image" | ||
:key="image" | ||
@load="loaded = true" | ||
> | ||
<VueIcon | ||
v-else | ||
:icon="icon" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
image: { | ||
type: String, | ||
default: null | ||
}, | ||
icon: { | ||
type: String, | ||
default: 'widgets' | ||
}, | ||
selected: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
data () { | ||
return { | ||
loaded: false | ||
} | ||
}, | ||
watch: { | ||
image (value) { | ||
this.loaded = false | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="stylus" scoped> | ||
@import "~@/style/imports" | ||
.item-logo | ||
margin-right $padding-item | ||
.wrapper | ||
h-box() | ||
box-center() | ||
width 42px | ||
height @width | ||
background rgba(black, .03) | ||
border-radius 50% | ||
overflow hidden | ||
.image | ||
width 100% | ||
height @width | ||
transform scale(0) | ||
.vue-icon | ||
width 24px | ||
height @width | ||
>>> svg | ||
fill rgba($color-text-light, .3) | ||
&.loaded | ||
.image | ||
animation zoom .1s | ||
transform none | ||
&.selected | ||
.wrapper | ||
background $vue-color-primary | ||
animation zoom .1s | ||
.vue-icon | ||
>>> svg | ||
fill $vue-color-light | ||
@keyframes zoom | ||
0% | ||
transform scale(0) | ||
100% | ||
transform scale(1) | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.