@@ -6,6 +6,9 @@ Behind the scenes, it is running [pymsi](https://github.com/nightlark/pymsi/) us
66
77<div id =" msi-viewer-app " >
88 <div class =" file-selector " >
9+ <div style="margin-bottom: 1rem;">
10+ <button id="load-example-file-button" type="button" class="example-file-btn">Load example file</button>
11+ </div>
912 <div class="file-input-container">
1013 <input type="file" id="msi-file-input" accept=".msi" />
1114 <label for="msi-file-input" class="file-input-label">
@@ -93,11 +96,21 @@ Behind the scenes, it is running [pymsi](https://github.com/nightlark/pymsi/) us
9396 display : inline-block ;
9497 }
9598
99+ .file-input-container.dragover .file-input-label {
100+ background : #005a9e ;
101+ color : #e3f2fd ;
102+ border : 2px solid #90caf9 ;
103+ box-shadow : 0 2px 16px 0 rgba (0 , 122 , 204 , 0.22 );
104+ }
105+
96106 #msi-file-input {
97107 position : absolute ;
98108 opacity : 0 ;
99109 width : 100% ;
100110 height : 100% ;
111+ left : 0 ;
112+ top : 0 ;
113+ z-index : 2 ;
101114 cursor : pointer ;
102115 }
103116
@@ -111,17 +124,21 @@ Behind the scenes, it is running [pymsi](https://github.com/nightlark/pymsi/) us
111124 border-radius : 6px ;
112125 cursor : pointer ;
113126 font-weight : 500 ;
114- transition : background-color 0.2s ease ;
127+ transition : background-color 0.2s , box-shadow 0.2 s , border 0.2 s , color 0.2 s ;
115128 border : 2px solid transparent ;
129+ box-shadow : none ;
130+ position : relative ;
131+ z-index : 1 ;
116132 }
117133
118- .file-input-label :hover {
119- background : #005a9e ;
120- }
121-
134+ .file-input-label :hover ,
135+ .file-input-container :hover .file-input-label ,
122136 .file-input-label :focus-within {
123- outline : 2px solid #007acc ;
124- outline-offset : 2px ;
137+ background : #005a9e ;
138+ color : #e3f2fd ;
139+ border : 2px solid #90caf9 ;
140+ box-shadow : 0 2px 12px 0 rgba (0 , 122 , 204 , 0.18 );
141+ outline : none ;
125142 }
126143
127144 #loading-indicator {
@@ -214,7 +231,51 @@ Behind the scenes, it is running [pymsi](https://github.com/nightlark/pymsi/) us
214231 overflow-y : auto ;
215232 border : 1px solid #ddd ;
216233 }
234+
235+ .example-file-btn {
236+ font-size : 0.95em ;
237+ padding : 0.3em 0.9em ;
238+ background : #f5f5f5 ;
239+ color : #007acc ;
240+ border : 1px solid #b0d4f1 ;
241+ border-radius : 4px ;
242+ cursor : pointer ;
243+ margin-bottom : 0.5rem ;
244+ transition : background 0.2s , color 0.2s , border 0.2s ;
245+ vertical-align : middle ;
246+ }
247+ .example-file-btn :hover ,
248+ .example-file-btn :focus {
249+ background : #e3f2fd ;
250+ color : #005a9e ;
251+ border-color : #90caf9 ;
252+ outline : none ;
253+ }
217254</style >
255+ <script >
256+ // filepath: pymsi/docs/msi_viewer.md (inline script)
257+ document .addEventListener (' DOMContentLoaded' , function () {
258+ var fileInputContainer = document .querySelector (' .file-input-container' );
259+ if (! fileInputContainer) return ;
260+
261+ // Highlight on drag over
262+ fileInputContainer .addEventListener (' dragenter' , function (e ) {
263+ e .preventDefault ();
264+ fileInputContainer .classList .add (' dragover' );
265+ });
266+ fileInputContainer .addEventListener (' dragover' , function (e ) {
267+ e .preventDefault ();
268+ fileInputContainer .classList .add (' dragover' );
269+ });
270+ fileInputContainer .addEventListener (' dragleave' , function (e ) {
271+ if (e .relatedTarget && fileInputContainer .contains (e .relatedTarget )) return ;
272+ fileInputContainer .classList .remove (' dragover' );
273+ });
274+ fileInputContainer .addEventListener (' drop' , function (e ) {
275+ fileInputContainer .classList .remove (' dragover' );
276+ });
277+ });
278+ </script >
218279
219280<!-- Include the Pyodide script -->
220281<script type =" text/javascript " src =" https://cdn.jsdelivr.net/pyodide/v0.23.4/full/pyodide.js " ></script >
0 commit comments