File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1919
2020<script >
2121import imageAsset from ' docc-render/mixins/imageAsset' ;
22- import { normalizeAssetUrl } from ' docc-render/utils/assets' ;
23-
24- const toCSSUrl = url => (url ? ` url('${ normalizeAssetUrl (url)} ')` : undefined );
22+ import { toCSSUrl } from ' docc-render/utils/assets' ;
2523
2624export default {
2725 name: ' CardCover' ,
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ import LinkableElement from 'docc-render/components/LinkableElement.vue';
7373
7474import GenericModal from ' docc-render/components/GenericModal.vue' ;
7575import PlayIcon from ' theme/components/Icons/PlayIcon.vue' ;
76- import { normalizeAssetUrl } from ' docc-render/utils/assets' ;
76+ import { normalizeAssetUrl , toCSSUrl } from ' docc-render/utils/assets' ;
7777import HeroMetadata from ' ./HeroMetadata.vue' ;
7878
7979export default {
@@ -140,14 +140,14 @@ export default {
140140 variant .traits .includes (' light' )
141141 ));
142142
143- return lightVariant ? normalizeAssetUrl ( lightVariant .url ) : ' ' ;
143+ return ( lightVariant || {}) .url ;
144144 },
145145 projectFilesUrl () {
146146 return this .projectFiles ? normalizeAssetUrl (this .references [this .projectFiles ].url ) : null ;
147147 },
148148 bgStyle () {
149149 return {
150- backgroundImage: ` url(' ${ this .backgroundImageUrl } ') ` ,
150+ backgroundImage: toCSSUrl ( this .backgroundImageUrl ) ,
151151 };
152152 },
153153 xcodeRequirementData () {
Original file line number Diff line number Diff line change @@ -75,3 +75,10 @@ export function normalizeAssetUrl(url) {
7575 }
7676 return pathJoin ( [ baseUrl , url ] ) ;
7777}
78+
79+ /**
80+ * Transforms a URL string into a normalized css `url(/path)` format.
81+ * @param {String } url
82+ * @returns {string|undefined }
83+ */
84+ export function toCSSUrl ( url ) { return url ? `url('${ normalizeAssetUrl ( url ) } ')` : undefined ; }
You can’t perform that action at this time.
0 commit comments