Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13734ff

Browse files
committed
remove image on windows due to image path issue
1 parent37a37c2 commit13734ff

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

‎lib/components/Start/Welcome/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
varReact=require('react');
33
varpath_1=require('path');
44
varindex_1=require('../../index');
5-
varimagePath=path_1.join(__dirname,'../../../../','img','coderoad.jpg');
65
varstyles={
76
header:{
8-
backgroundImage:"url(\""+imagePath+"\")",
97
backgroundRepeat:'no-repeat',
108
backgroundColor:'inherit',
119
height:'350px',
@@ -27,6 +25,10 @@ var styles = {
2725
textShadow:'1px 1px 0px #000',
2826
},
2927
};
28+
if(!navigator.platform.match(/Win/)){
29+
varimagePath=path_1.resolve(__dirname,'..','..','..','..','img','coderoad.jpg');
30+
styles.header.backgroundImage="url("+imagePath+")";
31+
}
3032
varWelcome=function(_a){
3133
vartitle=_a.title,tagline=_a.tagline,firstRoute=_a.firstRoute;
3234
return(React.createElement("div",{style:styles.header,className:'cr-bg'},

‎src/components/Start/Welcome/index.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import*asReactfrom'react';
2-
import{join}from'path';
2+
import{resolve}from'path';
33
import{RouteButton}from'../../index';
44

5-
// TODO: fix path
6-
constimagePath=join(
7-
__dirname,'../../../../','img','coderoad.jpg'
8-
);
9-
10-
conststyles={
5+
letstyles={
116
header:{
12-
backgroundImage:`url("${imagePath}")`,
137
backgroundRepeat:'no-repeat',
148
backgroundColor:'inherit',
159
height:'350px',
@@ -32,6 +26,16 @@ const styles = {
3226
},
3327
};
3428

29+
// issue: image not loading on Windows
30+
// due to url parse/replacing providing
31+
// invalid path
32+
if(!navigator.platform.match(/Win/)){
33+
constimagePath=resolve(
34+
__dirname,'..','..','..','..','img','coderoad.jpg'
35+
);
36+
styles.header.backgroundImage=`url(${imagePath})`;
37+
}
38+
3539
constWelcome:React.StatelessComponent<{
3640
title:string,tagline:string,firstRoute:string
3741
}>=({title, tagline, firstRoute})=>(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp