Refactor <img> tags to use Image component

This commit is contained in:
aonomike 2019-05-07 15:21:42 +03:00
parent f4b054d4c5
commit 3ff034d014
5 changed files with 53 additions and 16 deletions

View File

@ -10,22 +10,31 @@
:key="badge.key"
class="hc-badge-container"
>
<img
<hc-image
:title="badge.key"
:src="badge.icon"
:imageProps="imageProps(badge.icon)"
class="hc-badge"
>
/>
</div>
</div>
</template>
<script>
import HcImage from './Image'
export default {
components: {
HcImage
},
props: {
badges: {
type: Array,
default: () => []
}
},
methods: {
imageProps(icon) {
return { src: icon}
}
}
}
</script>

View File

@ -5,13 +5,13 @@
:margin="margin"
>
<ds-text>
<img
:src="iconPath"
<hc-image
:imageProps="imageProps"
width="80"
class="hc-empty-icon"
style="margin-bottom: 5px"
alt="Empty"
><br>
/><br>
<ds-text
v-show="message"
class="hc-empty-message"
@ -24,7 +24,11 @@
</template>
<script>
import HcImage from '~/components/Image'
export default {
components: {
HcImage
},
name: 'HcEmpty',
props: {
/**
@ -56,6 +60,9 @@ export default {
computed: {
iconPath() {
return `/img/empty/${this.icon}.svg`
},
imageProps: {
src: iconPath
}
}
}

View File

@ -30,11 +30,11 @@
margin-bottom="xxx-small"
centered
>
<img
<hc-image
class="login-image"
src="/img/sign-up/humanconnection.svg"
alt="Human Connection"
>
:imageProps="imageProps"
/>
</ds-space>
</ds-flex-item>
<ds-flex-item
@ -96,12 +96,14 @@
<script>
import LocaleSwitch from '~/components/LocaleSwitch'
import HcImage from '~/components/Image'
import gql from 'graphql-tag'
export default {
components: {
LocaleSwitch
LocaleSwitch,
HcImage
},
layout: 'blank',
data() {
@ -116,6 +118,9 @@ export default {
computed: {
pending() {
return this.$store.getters['auth/pending']
},
imageProps() {
return {src:"/img/sign-up/humanconnection.svg"}
}
},
asyncData({ store, redirect }) {

View File

@ -11,11 +11,11 @@
margin-bottom="xxx-small"
centered
>
<img
<hc-image
style="width: 200px;"
src="/img/sign-up/onourjourney.png"
:imageProps="imageProps"
alt="Human Connection"
>
/>
</ds-space>
<ds-space
style="text-align: center;"
@ -36,11 +36,20 @@
</template>
<script>
import HcImage from '~/components/Image'
export default {
components: {
HcImage
},
layout: 'blank',
async beforeCreate() {
await this.$store.dispatch('auth/logout')
this.$router.replace('/')
},
computed: {
imageProps(){
return { src: "/img/sign-up/onourjourney.png"}
}
}
}
</script>

View File

@ -11,12 +11,12 @@
:key="link.url"
>
<a :href="link.url">
<img
:src="link.favicon"
<hc-image
:imageProps="imageProps(link.favicon)"
alt="Social Media link"
width="16"
height="16"
>
/>
{{ link.url }}
</a>
</ds-list-item>
@ -45,8 +45,12 @@
<script>
import gql from 'graphql-tag'
import { mapGetters, mapMutations } from 'vuex'
import HcImage from '~/components/Image'
export default {
components: {
HcImage
},
data() {
return {
value: ''
@ -101,6 +105,9 @@ export default {
this.$toast.success(this.$t('settings.social-media.success')),
(this.value = '')
)
},
imageProps(favicon) {
return { src: favicon}
}
}
}