@@ -45,10 +45,10 @@ function doneAddFile() {
4545 pendingFilename .value = DEFAULT_FILE_NAME
4646}
4747
48- const fileSel = ref (null )
48+ const fileManagerBarRef = ref (null )
4949function horizontalScroll(e : WheelEvent ) {
5050 e .preventDefault ()
51- const el = fileSel .value ! as HTMLElement
51+ const el = fileManagerBarRef .value ! as HTMLElement
5252 const direction = Math .abs (e .deltaX ) >= Math .abs (e .deltaY ) ? e .deltaX : e .deltaY
5353 const distance = 30 * (direction > 0 ? 1 : - 1 )
5454 el .scrollTo ({
@@ -58,23 +58,30 @@ function horizontalScroll(e: WheelEvent) {
5858 </script >
5959
6060<template >
61- <div ref =" fileSel" class =" file-selector" :class =" {'has-import-map': showImportMap}" @wheel =" horizontalScroll" >
61+ <div
62+ ref =" fileManagerBarRef"
63+ class =" vue-playground-file-manager-bar"
64+ :class =" {'vue-playground-file-manager-bar-has-import-map': showImportMap}"
65+ @wheel =" horizontalScroll"
66+ >
6267 <div
6368 v-for =" (fileName, i) in fileNames"
6469 :key =" i"
65- class =" file"
66- :class =" {active: store.state.activeFile.filename === fileName}"
70+ class =" vue-playground-file-manager-bar- file"
71+ :class =" {'vue-playground-file-manager-bar-file- active' : store.state.activeFile.filename === fileName}"
6772 @click =" store.setActive(fileName)"
6873 >
69- <span class =" label" >{{ fileName === importMapFile ? 'Import Map' : fileName }}</span >
70- <span v-if =" i > 0" class =" remove" @click.stop =" store.deleteFile(fileName)" >
71- <svg class =" icon" width =" 12" height =" 12" viewBox =" 0 0 24 24" >
74+ <span class =" vue-playground-file-manager-bar-file-filename" >{{
75+ fileName === importMapFile ? 'Import Map' : fileName
76+ }}</span >
77+ <span v-if =" i > 0" class =" vue-playground-file-manager-bar-file-remove" @click.stop =" store.deleteFile(fileName)" >
78+ <svg class =" vue-playground-file-manager-bar-file-remove-icon" width =" 12" height =" 12" viewBox =" 0 0 24 24" >
7279 <line stroke =" #999" x1 =" 18" y1 =" 6" x2 =" 6" y2 =" 18" ></line >
7380 <line stroke =" #999" x1 =" 6" y1 =" 6" x2 =" 18" y2 =" 18" ></line >
7481 </svg >
7582 </span >
7683 </div >
77- <div v-if =" pending" class =" file pending" >
84+ <div v-if =" pending" class =" vue-playground- file-manager-bar- pending" >
7885 <input
7986 v-model =" pendingFilename"
8087 spellcheck =" false"
@@ -84,112 +91,141 @@ function horizontalScroll(e: WheelEvent) {
8491 @vnodeMounted =" focus"
8592 />
8693 </div >
87- <button class =" add" @click =" startAddFile" >+</button >
8894
89- <div v-if =" showImportMap" class =" import-map-wrapper" >
95+ <div class =" vue-playground-file-manager-bar-create-btn" @click =" startAddFile" >+</div >
96+
97+ <div v-if =" showImportMap" class =" vue-playground-file-manager-bar-import-map-wrapper" >
9098 <div
91- class =" file import-map"
99+ class =" vue-playground- file-manager-bar- import-map"
92100 :class =" {active: store.state.activeFile.filename === importMapFile}"
93101 @click =" store.setActive(importMapFile)"
94102 >
95- <span class =" label " >Import Map</span >
103+ <span class =" vue-playground-file-manager-bar-import-map-name " >Import Map</span >
96104 </div >
97105 </div >
98106 </div >
99107</template >
100108
101109<style scoped>
102- .file-selector {
110+ .vue-playground- file-manager-bar {
103111 position : relative ;
104112 box-sizing : border-box ;
105113 display : flex ;
106- height : var (--header-height );
114+ flex-shrink : 0 ;
115+ width : 100% ;
116+ height : 40px ;
107117 overflow-x : auto ;
108118 overflow-y : hidden ;
109119 white-space : nowrap ;
110- background-color : var ( --bg ) ;
111- border-bottom : 1px solid var ( --border ) ;
120+ background-color : #fff ;
121+ border-bottom : 1px solid #e5e7eb ;
112122}
113123
114- .file-selector ::-webkit-scrollbar {
124+ .vue-playground- file-manager-bar ::-webkit-scrollbar {
115125 height : 1px ;
116126}
117127
118- .file-selector ::-webkit-scrollbar-track {
119- background-color : var ( --border ) ;
128+ .vue-playground- file-manager-bar ::-webkit-scrollbar-track {
129+ background-color : #e5e7eb ;
120130}
121131
122- .file-selector ::-webkit-scrollbar-thumb {
123- background-color : var ( --color-branding ) ;
132+ .vue-playground- file-manager-bar ::-webkit-scrollbar-thumb {
133+ background-color : #584984 ;
124134}
125135
126- .file-selector. has-import-map .add {
136+ .vue-playground- file-manager-bar- has-import-map .vue-playground-file-manager-bar-create-btn {
127137 margin-right : 10px ;
128138}
129139
130- .file {
140+ .vue-playground-file-manager-bar- file {
131141 box-sizing : border-box ;
132- display : inline-block ;
133- font-family : var (--font-code );
134- font-size : 13px ;
135- color : var (--text-light );
142+ display : flex ;
143+ align-items : center ;
144+ justify-content : center ;
145+ padding : 0 8px ;
146+ margin : 2px 2px 0 ;
147+ font-size : 12px ;
148+ font-weight : 600 ;
149+ color : #94a3b8 ;
136150 cursor : pointer ;
151+ user-select : none ;
152+ border-bottom : 3px solid transparent ;
137153}
138- .file.active {
139- color : var (--color-branding );
154+
155+ .vue-playground-file-manager-bar-file-active {
156+ color : #584984 ;
140157 cursor : text ;
141- border-bottom : 3px solid var ( --color-branding ) ;
158+ border-bottom : 3px solid #584984 ;
142159}
143- .file span {
144- display : inline-block ;
160+
161+ .vue-playground-file-manager-bar-file span {
162+ display : flex ;
145163 padding : 8px 10px 6px ;
146164 line-height : 20px ;
147165}
148- .file.pending input {
166+
167+ .vue-playground-file-manager-bar-file-remove {
168+ display : flex ;
169+ padding-left : 0 ;
170+ line-height : 12px ;
171+ vertical-align : middle ;
172+ cursor : pointer ;
173+ }
174+
175+ .vue-playground-file-manager-bar-file-remove-icon {
176+ margin-top : -1px ;
177+ }
178+
179+ .vue-playground-file-manager-bar-pending {
180+ display : flex ;
181+ align-items : center ;
182+ justify-content : center ;
183+ }
184+
185+ .vue-playground-file-manager-bar-pending input {
149186 width : 90px ;
150187 height : 30px ;
151188 padding : 0 0 0 10px ;
152189 margin-top : 2px ;
153190 margin-left : 6px ;
154- font-family : var (--font-code );
155191 font-size : 12px ;
156192 line-height : 30px ;
157- border : 1px solid var (--border );
193+ color : #584984 ;
194+ border : 1px solid #584984 ;
158195 border-radius : 4px ;
159196 outline : none ;
160197}
161- .file .remove {
162- display : inline-block ;
163- padding-left : 0 ;
164- line-height : 12px ;
165- vertical-align : middle ;
166- cursor : pointer ;
167- }
168- .add {
169- position : relative ;
170- top : -1px ;
198+
199+ .vue-playground-file-manager-bar-create-btn {
200+ display : flex ;
201+ align-items : center ;
202+ justify-content : center ;
171203 margin-left : 6px ;
172- font-family : var (--font-code );
173204 font-size : 18px ;
174- color : #999 ;
175- vertical-align : middle ;
176- }
177- .add :hover {
178- color : var (--color-branding );
205+ color : #94a3b8 ;
206+ cursor : pointer ;
179207}
180- .icon {
181- margin-top : -1px ;
208+
209+ .vue-playground-file-manager-bar-create-btn :hover {
210+ color : #584984 ;
182211}
183- .import-map-wrapper {
212+
213+ .vue-playground-file-manager-bar-import-map-wrapper {
184214 position : sticky ;
185215 top : 0 ;
186216 right : 0 ;
187- padding-left : 30px ;
217+ display : flex ;
218+ align-items : center ;
219+ justify-content : center ;
220+ padding : 0 15px ;
188221 margin-left : auto ;
222+ font-size : 12px ;
223+ color : #94a3b8 ;
224+ cursor : pointer ;
189225 background : linear-gradient (90deg , rgba (255 , 255 , 255 , 0 ) 0% , rgba (255 , 255 , 255 , 1 ) 25% );
190- background-color : var (--bg );
191226}
192- .dark .import-map-wrapper {
227+
228+ .vue-playground-dark .vue-playground-file-manager-bar-import-map-wrapper {
193229 background : linear-gradient (90deg , rgba (26 , 26 , 26 , 0 ) 0% , rgba (26 , 26 , 26 , 1 ) 25% );
194230}
195231 </style >
0 commit comments