11<template >
22 <div class =" c-sidebar-brand" >
33 <slot >
4- <CLink v-if =" wrappedInLink" v-bind =" wrappedInLink " >
4+ <CLink v-if =" wrappedInLink" v-bind =" linkProps " >
55 <img
66 class =" c-sidebar-brand-full"
7- :src =" fullSrc || src"
8- width =" 118"
9- height =" 46"
10- alt =" Logo"
7+ v-bind =" fullAttributes"
118 >
129 <img
1310 class =" c-sidebar-brand-minimized"
14- :src =" minimizedSrc || src"
15- width =" 118"
16- height =" 46"
17- alt =" Logo"
11+ v-bind =" minimizedAttributes"
1812 >
1913 </CLink >
2014 <template v-else >
2115 <img
22- class =" c-sidebar-brand-full"
23- :src =" fullSrc || src"
24- width =" 118"
25- height =" 46"
26- alt =" Logo"
16+ class =" c-sidebar-brand-full"
17+ v-bind =" fullAttributes"
2718 >
2819 <img
2920 class =" c-sidebar-brand-minimized"
30- :src =" minimizedSrc || src"
31- width =" 118"
32- height =" 46"
33- alt =" Logo"
21+ v-bind =" minimizedAttributes"
3422 >
3523 </template >
3624 </slot >
@@ -45,10 +33,26 @@ export default {
4533 CLink
4634 },
4735 props: {
48- src: String ,
49- fullSrc: String ,
50- minimizedSrc: String ,
51- wrappedInLink: Object
36+ img: [String , Object ],
37+ imgFull: [String , Object ],
38+ imgMinimized: [String , Object ],
39+ wrappedInLink: [String , Object ]
40+ },
41+ computed: {
42+ linkProps () {
43+ return this .getObject (this .wrappedInLink , ' href' )
44+ },
45+ minimizedAttributes () {
46+ return this .getObject (this .imgMinimized || this .img , ' src' )
47+ },
48+ fullAttributes () {
49+ return this .getObject (this .imgFull || this .img , ' src' )
50+ }
51+ },
52+ methods: {
53+ getObject (prop , key ) {
54+ return typeof prop === ' object' ? prop : { [` ${ key} ` ]: prop }
55+ }
5256 }
5357}
5458 </script >
0 commit comments