File tree Expand file tree Collapse file tree 2 files changed +20
-17
lines changed
packages/react-renderer-demo/src Expand file tree Collapse file tree 2 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -15,19 +15,15 @@ const HashTagSvg = (props) => (
1515 > </ path >
1616) ;
1717
18- const ShareButton = ( { path } ) => {
19- console . log ( process . env . NEXT_PUBLIC_VAR_VAL ) ;
20-
21- return (
22- < CopyToClipboard text = { urlFormatter ( path ) } >
23- < IconButton size = "medium" >
24- < SvgIcon fontSize = "small" viewBox = "0 0 48 48" >
25- < HashTagSvg />
26- </ SvgIcon >
27- </ IconButton >
28- </ CopyToClipboard >
29- ) ;
30- } ;
18+ const ShareButton = ( { path } ) => (
19+ < CopyToClipboard text = { urlFormatter ( path ) } >
20+ < IconButton size = "medium" >
21+ < SvgIcon fontSize = "small" viewBox = "0 0 48 48" >
22+ < HashTagSvg />
23+ </ SvgIcon >
24+ </ IconButton >
25+ </ CopyToClipboard >
26+ ) ;
3127
3228ShareButton . propTypes = {
3329 path : PropTypes . string . isRequired ,
Original file line number Diff line number Diff line change 11export const urlFormatter = ( initPath ) => {
2- const env = process . env . NEXT_PUBLIC_VERCEL_ENV ;
3- const url = process . env . NEXT_PUBLIC_VERCEL_URL ;
4- const branchUrl = process . env . NEXT_PUBLIC_VERCEL_BRANCH_URL ;
2+ const nextEnv = process . env . NEXT_PUBLIC_VERCEL_ENV ;
3+ const nextUrl = process . env . NEXT_PUBLIC_VERCEL_URL ;
4+ const nextBranchUrl = process . env . NEXT_PUBLIC_VERCEL_BRANCH_URL ;
55
6- if ( env === 'preview' ) {
6+ const env = process . env . VERCEL_ENV ;
7+ const url = process . env . VERCEL_URL ;
8+ const branchUrl = process . env . VERCEL_BRANCH_URL ;
9+
10+ console . log ( `NEXT_PUBLIC_VERCEL_ENV= ${ nextEnv } , NEXT_PUBLIC_VERCEL_URL= ${ nextUrl } , NEXT_PUBLIC_VERCEL_BRANCH_URL= ${ nextBranchUrl } ` ) ;
11+ console . log ( `VERCEL_ENV= ${ env } , VERCEL_URL= ${ url } , VERCEL_BRANCH_URL= ${ branchUrl } ` ) ;
12+
13+ if ( env === 'preview' || nextEnv === 'preview' ) {
714 return `https://${ branchUrl + initPath } ` ;
815 }
916
You can’t perform that action at this time.
0 commit comments