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

View File

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

View File

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

View File

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

View File

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