@@ -2,17 +2,14 @@ import Dismiss from 'solid-dismiss';
22import { Icon } from 'solid-heroicons' ;
33import { Component , onCleanup , createSignal , Show } from 'solid-js' ;
44import { download , xCircle , menu , moon , sun } from 'solid-heroicons/outline' ;
5-
6- import logo from '../assets/logo.svg?url' ;
7- import type { Tab } from '../../src' ;
85import { exportToZip } from '../utils/exportFiles' ;
96import { ZoomDropdown } from './zoomDropdown' ;
107import { API , useAppContext } from '../context' ;
8+ import logo from '../assets/logo.svg?url' ;
119
1210export const Header : Component < {
1311 dark : boolean ;
1412 toggleDark : ( ) => void ;
15- tabs : Tab [ ] ;
1613} > = ( props ) => {
1714 const context = useAppContext ( ) ! ;
1815 const [ showMenu , setShowMenu ] = createSignal ( false ) ;
@@ -28,7 +25,7 @@ export const Header: Component<{
2825 }
2926
3027 return (
31- < header class = "p-1 flex text-sm justify-between items-center border-slate-200 dark:border-neutral-800 border-b-2px" >
28+ < header class = "sticky top-0 z-10 bg-white dark:bg-solid-darkbg p-1 flex text-sm justify-between items-center border-slate-200 dark:border-neutral-800 border-b-2px" >
3229 < h1 class = "flex items-center space-x-4 uppercase leading-0 tracking-widest pl-1" >
3330 < a href = "/" >
3431 < img src = { logo } alt = "solid-js logo" class = "w-8" />
@@ -39,7 +36,7 @@ export const Header: Component<{
3936 </ span >
4037 </ div >
4138 </ h1 >
42- < div class = "flex items-center" >
39+ < div class = "flex items-center gap-3 mr-2 " >
4340 < Dismiss
4441 classList = { { 'absolute top-[53px] right-[10px] w-[fit-content] z-10' : showMenu ( ) } }
4542 menuButton = { ( ) => menuBtnEl }
@@ -51,16 +48,15 @@ export const Header: Component<{
5148 class = "md:items-center md:space-x-2 md:flex md:flex-row"
5249 classList = { {
5350 'shadow-md flex flex-col justify-center bg-white dark:bg-solid-darkbg' : showMenu ( ) ,
54- hidden : ! showMenu ( ) ,
51+ ' hidden' : ! showMenu ( ) ,
5552 } }
5653 >
5754 < button
5855 type = "button"
5956 onClick = { props . toggleDark }
60- class = "flex flex-row space-x-2 items-center md:px-1 px-2 py-2 focus:outline-none focus:ring-1 rounded opacity-80 hover:opacity-100"
57+ class = "flex flex-row space-x-2 items-center md:px-1 px-2 py-2 rounded opacity-80 hover:opacity-100"
6158 classList = { {
62- 'rounded-none active:bg-gray-300 hover:bg-gray-300 dark:hover:text-black focus:outline-none focus:highlight-none active:highlight-none focus:ring-0 active:outline-none' :
63- showMenu ( ) ,
59+ 'rounded-none active:bg-gray-300 hover:bg-gray-300 dark:hover:text-black' : showMenu ( ) ,
6460 } }
6561 title = "Toggle dark mode"
6662 >
@@ -70,19 +66,21 @@ export const Header: Component<{
7066 < span class = "text-xs md:sr-only" > { props . dark ? 'Light' : 'Dark' } mode</ span >
7167 </ button >
7268
73- < button
74- type = "button"
75- onClick = { ( ) => exportToZip ( props . tabs ) }
76- class = "flex flex-row space-x-2 items-center md:px-1 px-2 py-2 focus:outline-none focus:ring-1 rounded opacity-80 hover:opacity-100"
77- classList = { {
78- 'rounded-none active:bg-gray-300 hover:bg-gray-300 dark:hover:text-black focus:outline-none focus:highlight-none active:highlight-none focus:ring-0 active:outline-none' :
79- showMenu ( ) ,
80- } }
81- title = "Export to Zip"
82- >
83- < Icon path = { download } class = "h-6" style = { { margin : '0' } } />
84- < span class = "text-xs md:sr-only" > Export to Zip</ span >
85- </ button >
69+ < Show when = { context . tabs ( ) } >
70+ < button
71+ type = "button"
72+ onClick = { ( ) => exportToZip ( context . tabs ( ) ! ) }
73+ class = "flex flex-row space-x-2 items-center md:px-1 px-2 py-2 rounded opacity-80 hover:opacity-100"
74+ classList = { {
75+ 'rounded-none active:bg-gray-300 hover:bg-gray-300 dark:hover:text-black' : showMenu ( ) ,
76+ } }
77+ title = "Export to Zip"
78+ >
79+ < Icon path = { download } class = "h-6" style = { { margin : '0' } } />
80+ < span class = "text-xs md:sr-only" > Export to Zip</ span >
81+ </ button >
82+ </ Show >
83+
8684 < ZoomDropdown showMenu = { showMenu ( ) } />
8785 </ div >
8886 </ Dismiss >
@@ -92,7 +90,7 @@ export const Header: Component<{
9290 classList = { {
9391 'border-white border' : showMenu ( ) ,
9492 } }
95- class = "px-3 py-2 focus:outline-none focus:ring-1 rounded opacity-80 hover:opacity-100 visible relative md:hidden m-0 mr-[10px] "
93+ class = "px-3 py-2 rounded opacity-80 hover:opacity-100 visible relative md:hidden m-0"
9694 title = "Mobile Menu Button"
9795 ref = { menuBtnEl }
9896 >
@@ -101,16 +99,24 @@ export const Header: Component<{
10199 </ Show >
102100 < span class = "sr-only" > Show menu</ span >
103101 </ button >
104- < div class = "mx-5 -mb-1 leading-snug cursor-pointer" >
102+ < div class = "leading-snug cursor-pointer" >
105103 < Show
106- when = { context . user ( ) ?. display }
104+ when = { context . user ( ) ?. avatar }
107105 fallback = {
108- < a href = { `${ API } /auth/login?redirect=${ window . location . origin } /login?auth=success` } rel = "external" >
106+ < a
107+ class = "mx-1 -mb-1"
108+ href = { `${ API } /auth/login?redirect=${ window . location . origin } /login?auth=success` }
109+ rel = "external"
110+ >
109111 Login
110112 </ a >
111113 }
112114 >
113- { ( x ) => < a href = "/" > { x } </ a > }
115+ { ( x ) => (
116+ < a href = "/" >
117+ < img crossOrigin = "anonymous" src = { x } class = "w-8 h-8 rounded-full" />
118+ </ a >
119+ ) }
114120 </ Show >
115121 </ div >
116122 </ div >
0 commit comments