File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed
packages/astro/src/default/components Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
import fs from ' node:fs' ;
3
+ import path from ' node:path' ;
3
4
import { LoginButton } from ' ./LoginButton' ;
4
5
import { ThemeSwitch } from ' ./ThemeSwitch' ;
5
6
import { useAuth } from ' ./setup' ;
6
7
8
+ const LOGO_EXTENSIONS = [
9
+ ' svg' ,
10
+ ' png' ,
11
+ ' jpeg' ,
12
+ ' jpg' ,
13
+ ];
14
+
7
15
let logo;
8
16
9
- try {
10
- logo = fs .readFileSync (' ./public/logo.svg' , { encoding: ' utf8' });
11
- } catch {
12
- console .warn (' No logo.svg found in public/' );
17
+ for (const logoFilename of LOGO_EXTENSIONS ) {
18
+ const exists = fs .existsSync (path .join (' public' , ` logo.${logoFilename } ` ));
19
+
20
+ if (exists ) {
21
+ logo = ` /${logoFilename } ` ;
22
+ break ;
23
+ }
24
+ }
25
+
26
+ if (! logo ) {
27
+ console .warn (` No logo found in public/. Supported filenames are: logo.(${LOGO_EXTENSIONS .join (' |' )}) ` );
13
28
}
14
29
---
15
30
@@ -18,12 +33,10 @@ try {
18
33
>
19
34
<div class =" flex flex-1" >
20
35
<a
21
- href =" # "
36
+ href =" / "
22
37
class =" flex items-center text-tk-elements-topBar-logo-color hover:text-tk-elements-topBar-logo-colorHover"
23
38
>
24
- <span class =" h-5 w-auto" >
25
- { logo && <Fragment set :html = { logo } />}
26
- </span >
39
+ { logo && <img class = " h-5 w-auto" src = { logo } />}
27
40
</a >
28
41
</div >
29
42
<div >
You can’t perform that action at this time.
0 commit comments