File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed
Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,13 @@ import { CONFIG } from "site.config"
44import styled from "@emotion/styled"
55
66const Logo = ( ) => {
7+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH || ""
8+ const logoSrc = `${ basePath } /images/shared/Microsoft-Logo-PNG-Photos.png`
9+
710 return (
811 < StyledWrapper href = "/" aria-label = { CONFIG . blog . title } >
912 < Image
10- src = "/images/shared/Microsoft-Logo-PNG-Photos.png"
13+ src = { logoSrc }
1114 alt = "Microsoft"
1215 width = { 28 }
1316 height = { 28 }
Original file line number Diff line number Diff line change @@ -11,6 +11,14 @@ type Props = {
1111}
1212
1313const PostHeader : React . FC < Props > = ( { data } ) => {
14+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH || ""
15+ const withBasePath = ( url ?: string ) => {
16+ if ( ! url ) return url
17+ if ( url . startsWith ( "http" ) || url . startsWith ( "data:" ) ) return url
18+ if ( url . startsWith ( "/" ) ) return `${ basePath } ${ url } `
19+ return url
20+ }
21+
1422 return (
1523 < StyledWrapper >
1624 < h1 className = "title" > { data . title } </ h1 >
@@ -22,7 +30,11 @@ const PostHeader: React.FC<Props> = ({ data }) => {
2230 < div className = "author" >
2331 < Image
2432 css = { { borderRadius : "50%" } }
25- src = { data . author [ 0 ] . profile_photo || CONFIG . profile . image }
33+ src = {
34+ withBasePath (
35+ data . author [ 0 ] . profile_photo || CONFIG . profile . image
36+ ) || ""
37+ }
2638 alt = "profile_photo"
2739 width = { 24 }
2840 height = { 24 }
@@ -51,7 +63,7 @@ const PostHeader: React.FC<Props> = ({ data }) => {
5163 { data . thumbnail && (
5264 < div className = "thumbnail" >
5365 < Image
54- src = { data . thumbnail }
66+ src = { withBasePath ( data . thumbnail ) || "" }
5567 css = { { objectFit : "cover" } }
5668 fill
5769 alt = { data . title }
Original file line number Diff line number Diff line change @@ -8,13 +8,18 @@ type Props = {
88}
99
1010const MobileProfileCard : React . FC < Props > = ( ) => {
11+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH || ""
12+ const profileSrc = CONFIG . profile . image . startsWith ( "/" )
13+ ? `${ basePath } ${ CONFIG . profile . image } `
14+ : CONFIG . profile . image
15+
1116 return (
1217 < StyledWrapper >
1318 < div className = "top" > 💻 Profile</ div >
1419 < div className = "mid" >
1520 < div className = "wrapper" >
1621 < Image
17- src = { CONFIG . profile . image }
22+ src = { profileSrc }
1823 width = { 90 }
1924 height = { 90 }
2025 css = { { position : "relative" } }
Original file line number Diff line number Diff line change @@ -7,14 +7,19 @@ import { Emoji } from "src/components/Emoji"
77type Props = { }
88
99const ProfileCard : React . FC < Props > = ( ) => {
10+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH || ""
11+ const profileSrc = CONFIG . profile . image . startsWith ( "/" )
12+ ? `${ basePath } ${ CONFIG . profile . image } `
13+ : CONFIG . profile . image
14+
1015 return (
1116 < StyledWrapper >
1217 < div className = "title" >
1318 < Emoji > 💻</ Emoji > Profile
1419 </ div >
1520 < div className = "content" >
1621 < div className = "top" >
17- < Image src = { CONFIG . profile . image } fill alt = "" />
22+ < Image src = { profileSrc } fill alt = "" />
1823 </ div >
1924 < div className = "mid" >
2025 < div className = " name" > { CONFIG . profile . name } </ div >
You can’t perform that action at this time.
0 commit comments