@@ -27,8 +27,14 @@ p.html(
2727
2828 let pyodideReady = $state (false );
2929
30+ let pyodideStatus = $state (' Please wait...' );
31+
32+ function pyodideStatusUpdate(status : string ) {
33+ pyodideStatus = status ;
34+ }
35+
3036 onMount (async () => {
31- await getPyodide ();
37+ await getPyodide (pyodideStatusUpdate );
3238 console .log (' Pyodide is ready' );
3339 renderHtml ();
3440 pyodideReady = true ;
@@ -37,7 +43,6 @@ p.html(
3743
3844<h1 >Try out PyHTML</h1 >
3945{#if pyodideReady }
40- <p class =" status" >Pyodide loaded successfully!</p >
4146 <main >
4247 <div class =" editor" >
4348 <h2 >Write some code</h2 >
@@ -59,7 +64,12 @@ p.html(
5964 </div >
6065 </main >
6166{:else }
62- <p class =" status" >Pyodide is loading...</p >
67+ <div class =" status-outer" >
68+ <div class =" status-inner" >
69+ <i class =" las la-sync spin" ></i >
70+ <p class ="status-text" >{pyodideStatus }</p >
71+ </div >
72+ </div >
6373{/if }
6474
6575<style >
@@ -68,28 +78,64 @@ p.html(
6878 }
6979
7080 h1 {
71- text-align : center ;
81+ margin : 0px ;
82+ padding : 10px ;
7283 }
73-
74- .status {
84+ h1 ,
85+ h2 {
7586 text-align : center ;
7687 }
7788
78- main {
79- display : grid ;
80- grid-template-areas :
81- ' editor preview'
82- ' editor html' ;
83- grid-template-columns : 1fr 1fr ;
84- grid-template-rows : 1fr 1fr ;
85-
89+ /* Status message when loading */
90+ .status-outer {
91+ width : 100% ;
92+ display : flex ;
93+ justify-content : center ;
94+ }
95+ .status-inner {
96+ min-width : 300px ;
97+ display : flex ;
98+ gap : 10px ;
99+ }
100+ .status-text {
86101 width : 100% ;
87- min-height : 100% ;
102+ }
103+ .spin {
104+ font-size : 1.5rem ;
105+ display : flex ;
106+ align-items : center ;
107+ justify-content : center ;
108+ animation : rotating 2s linear infinite ;
109+ }
110+ @keyframes rotating {
111+ from {
112+ transform : rotate (0deg );
113+ }
114+ to {
115+ transform : rotate (360deg );
116+ }
117+ }
118+
119+ /* Responsive design */
120+ @media only screen and (min-width : 1000px ) {
121+ main {
122+ display : grid ;
123+ grid-template-areas :
124+ ' editor preview'
125+ ' editor html' ;
126+ grid-template-columns : 1fr 1fr ;
127+ grid-template-rows : 1fr 1fr ;
128+
129+ width : 100% ;
130+ height : 100% ;
131+ }
88132 }
89133
90134 .editor {
91135 grid-area : editor;
92136 height : 100% ;
137+ width : 100% ;
138+ overflow : scroll ;
93139 }
94140
95141 .preview {
@@ -104,5 +150,10 @@ p.html(
104150 .html {
105151 grid-area : html;
106152 height : 100% ;
153+ width : 100% ;
154+ }
155+
156+ .html pre {
157+ overflow : scroll ;
107158 }
108159 </style >
0 commit comments