@@ -4,6 +4,61 @@ import ReactDOM from 'react-dom';
44import RemoteButton from 'app2/Button' ;
55import lodash from 'lodash' ;
66import ControlPanel from './ControlPanel' ;
7+
8+ const styles = {
9+ container : {
10+ padding : '2rem' ,
11+ maxWidth : '1200px' ,
12+ margin : '0 auto' ,
13+ fontFamily : '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' ,
14+ } ,
15+ header : {
16+ borderBottom : '2px solid #e9ecef' ,
17+ marginBottom : '2rem' ,
18+ paddingBottom : '1rem' ,
19+ } ,
20+ title : {
21+ fontSize : '2.5rem' ,
22+ color : '#2c3e50' ,
23+ margin : '0 0 1rem 0' ,
24+ } ,
25+ subtitle : {
26+ fontSize : '1.8rem' ,
27+ color : '#34495e' ,
28+ margin : '1rem 0' ,
29+ } ,
30+ versionInfo : {
31+ display : 'flex' ,
32+ flexDirection : 'column' ,
33+ gap : '0.5rem' ,
34+ backgroundColor : '#f8f9fa' ,
35+ padding : '1.5rem' ,
36+ borderRadius : '8px' ,
37+ marginBottom : '2rem' ,
38+ boxShadow : '0 2px 4px rgba(0,0,0,0.05)' ,
39+ } ,
40+ versionText : {
41+ margin : '0' ,
42+ fontSize : '1rem' ,
43+ fontWeight : '500' ,
44+ display : 'flex' ,
45+ alignItems : 'center' ,
46+ gap : '0.5rem' ,
47+ } ,
48+ dot : {
49+ width : '8px' ,
50+ height : '8px' ,
51+ borderRadius : '50%' ,
52+ display : 'inline-block' ,
53+ marginRight : '8px' ,
54+ } ,
55+ buttonContainer : {
56+ display : 'flex' ,
57+ gap : '1rem' ,
58+ marginBottom : '2rem' ,
59+ } ,
60+ } ;
61+
762const getColorFromString = str => {
863 let primes = [ 1 , 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 ] ;
964 let hash = 0 ;
@@ -17,24 +72,53 @@ const getColorFromString = str => {
1772 }
1873 return color ;
1974} ;
20- const App = ( ) => (
21- < div >
22- < h1 > Share Control Panel</ h1 >
23- < h2 > App 1</ h2 >
24- < h4 style = { { color : getColorFromString ( React . version ) } } > Host Used React: { React . version } </ h4 >
25- < h4 style = { { color : getColorFromString ( ReactDOM . version ) } } >
26- Host Used ReactDOM: { ReactDOM . version }
27- </ h4 >
28- < h4 style = { { color : getColorFromString ( lodash . VERSION ) } } >
29- Host Used Lodash: { lodash . VERSION }
30- </ h4 >
31-
32- < LocalButton />
33- < React . Suspense fallback = "Loading Button" >
34- < RemoteButton />
35- </ React . Suspense >
36- < ControlPanel />
37- </ div >
38- ) ;
75+
76+ const App = ( ) => {
77+ const reactColor = getColorFromString ( React . version ) ;
78+ const reactDomColor = getColorFromString ( ReactDOM . version ) ;
79+ const lodashColor = getColorFromString ( lodash . VERSION ) ;
80+
81+ return (
82+ < div style = { styles . container } >
83+ < header style = { styles . header } >
84+ < h1 style = { styles . title } > Share Control Panel</ h1 >
85+ < h2 style = { styles . subtitle } > App 1</ h2 >
86+ </ header >
87+
88+ < div style = { styles . versionInfo } >
89+ < h4 style = { styles . versionText } >
90+ < span style = { { ...styles . dot , backgroundColor : reactColor } } />
91+ Host Used React: { React . version }
92+ </ h4 >
93+ < h4 style = { styles . versionText } >
94+ < span style = { { ...styles . dot , backgroundColor : reactDomColor } } />
95+ Host Used ReactDOM: { ReactDOM . version }
96+ </ h4 >
97+ < h4 style = { styles . versionText } >
98+ < span style = { { ...styles . dot , backgroundColor : lodashColor } } />
99+ Host Used Lodash: { lodash . VERSION }
100+ </ h4 >
101+ </ div >
102+
103+ < div style = { styles . buttonContainer } >
104+ < LocalButton />
105+ < React . Suspense fallback = {
106+ < div style = { {
107+ padding : '0.5rem 1rem' ,
108+ backgroundColor : '#f8f9fa' ,
109+ borderRadius : '4px' ,
110+ color : '#666'
111+ } } >
112+ Loading Button...
113+ </ div >
114+ } >
115+ < RemoteButton />
116+ </ React . Suspense >
117+ </ div >
118+
119+ < ControlPanel />
120+ </ div >
121+ ) ;
122+ } ;
39123
40124export default App ;
0 commit comments