misskey/src/client/app/desktop/views/components/ui.header.search.vue

77 lines
1.3 KiB
Vue
Raw Normal View History

2018-02-12 13:10:16 +01:00
<template>
2018-02-20 14:53:34 +01:00
<form class="search" @submit.prevent="onSubmit">
<i><fa icon="search"/></i>
2018-04-14 18:04:40 +02:00
<input v-model="q" type="search" placeholder="%i18n:@placeholder%"/>
2018-02-12 13:10:16 +01:00
<div class="result"></div>
</form>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
data() {
return {
q: ''
};
},
methods: {
onSubmit() {
2018-06-10 05:21:44 +02:00
if (this.q.startsWith('#')) {
this.$router.push(`/tags/${encodeURIComponent(this.q.substr(1))}`);
} else {
this.$router.push(`/search?q=${encodeURIComponent(this.q)}`);
}
2018-02-12 13:10:16 +01:00
}
}
});
</script>
<style lang="stylus" scoped>
2018-09-27 08:19:11 +02:00
.search
2018-10-15 10:43:25 +02:00
@media (max-width 800px)
display none !important
> i
2018-02-12 13:10:16 +01:00
display block
position absolute
top 0
left 0
width 48px
text-align center
line-height 48px
2018-09-27 08:19:11 +02:00
color var(--desktopHeaderFg)
2018-02-12 13:10:16 +01:00
pointer-events none
> *
vertical-align middle
> input
user-select text
cursor auto
margin 8px 0 0 0
padding 6px 18px 6px 36px
width 14em
height 32px
font-size 1em
2018-09-27 08:19:11 +02:00
background var(--desktopHeaderSearchBg)
2018-02-12 13:10:16 +01:00
outline none
border none
border-radius 16px
transition color 0.5s ease, border 0.5s ease
2018-09-27 08:19:11 +02:00
color var(--desktopHeaderSearchFg)
2018-02-12 13:10:16 +01:00
2018-10-15 10:43:25 +02:00
@media (max-width 1000px)
width 10em
2018-02-12 13:10:16 +01:00
&::placeholder
2018-09-27 08:19:11 +02:00
color var(--desktopHeaderFg)
2018-02-12 13:10:16 +01:00
&:hover
2018-09-27 08:19:11 +02:00
background var(--desktopHeaderSearchHoverBg)
2018-02-12 13:10:16 +01:00
&:focus
2018-09-26 13:19:35 +02:00
box-shadow 0 0 0 2px var(--primaryAlpha05) !important
2018-02-12 13:10:16 +01:00
</style>