File tree Expand file tree Collapse file tree 10 files changed +375
-7
lines changed
Expand file tree Collapse file tree 10 files changed +375
-7
lines changed Original file line number Diff line number Diff line change 4848 "typescript" : " ^5.7.3" ,
4949 "typescript-eslint" : " ^8.22.0" ,
5050 "vite" : " ^6.1.0" ,
51+ "vite-plugin-svgr" : " ^4.3.0" ,
5152 "zwave-js" : " 14.3.8-0-pr-7628-ab659ee"
5253 },
5354 "packageManager" : " yarn@4.6.0"
Original file line number Diff line number Diff line change @@ -22,12 +22,14 @@ import ArrowTopRightOnSquareIcon from "@heroicons/react/24/outline/ArrowTopRight
2222
2323// FIXME: There should be a way to reuse the TS instance from the editor
2424import ts from "typescript" ;
25+ import { Header } from "./Header.tsx" ;
2526
2627interface AppProps {
2728 esbuild : typeof import ( "esbuild-wasm" ) ;
2829 showShareButton ?: boolean ;
2930 showOpenInNewWindowButton ?: boolean ;
3031 showEmbedButton ?: boolean ;
32+ showHeader ?: boolean ;
3133 defaultLogsVisible ?: boolean ;
3234}
3335
@@ -99,6 +101,7 @@ function App({
99101 showOpenInNewWindowButton,
100102 showEmbedButton,
101103 defaultLogsVisible,
104+ showHeader,
102105} : AppProps ) {
103106 const [ code , setCode ] = useState ( getDefaultCode ( ) . trim ( ) ) ;
104107 const [ hasPort , setHasPort ] = useState ( ! ! window . port ) ;
@@ -501,6 +504,7 @@ declare const Buffer: typeof Bytes;
501504
502505 return (
503506 < >
507+ { showHeader && < Header /> }
504508 < div className = "toolbar" >
505509 { ! isRunning && (
506510 < button id = "run" onClick = { handleRunClick } >
Original file line number Diff line number Diff line change 1+ header {
2+ display : flex;
3+ align-items : center;
4+
5+ background : # 1a1a1a ;
6+ color : white;
7+ margin : -1rem ;
8+ margin-bottom : 1rem ;
9+ padding : 0.5rem 1rem ;
10+ padding-right : 1.5rem ;
11+ }
12+
13+ header svg {
14+ vertical-align : middle;
15+ }
16+
17+ header h1 {
18+ font-size : 2rem ;
19+ font-weight : 400 ;
20+ line-height : 1 ;
21+ margin : 0 ;
22+ margin-right : auto;
23+
24+ display : inline-flex;
25+ align-items : center;
26+ }
27+
28+ header h1 span {
29+ margin-top : 0.27em ;
30+ }
31+
32+ .github-link {
33+ color : white;
34+ }
35+
36+ @media (prefers-color-scheme : light) {
37+ .github-link {
38+ color : # 24292f ;
39+ }
40+ }
Original file line number Diff line number Diff line change 1+ import "./Header.css" ;
2+ import Logo from "./assets/logo.svg?react" ;
3+ import GithubLogo from "./assets/github.svg?react" ;
4+
5+ export const Header = ( ) => {
6+ return (
7+ < header >
8+ < h1 >
9+ < Logo height = { 72 } width = { undefined } /> < span > Playground</ span >
10+ </ h1 >
11+ < a
12+ href = "https://github.com/zwave-js/playground"
13+ target = "_blank"
14+ title = "View on GitHub"
15+ className = "github-link"
16+ >
17+ < GithubLogo height = { 24 } width = { undefined } />
18+ </ a >
19+ </ header >
20+ ) ;
21+ } ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ if ("serial" in navigator) {
3030 showOpenInNewWindowButton = { isEmbed }
3131 showEmbedButton = { ! isEmbed }
3232 defaultLogsVisible = { ! isEmbed }
33+ showHeader = { ! isEmbed }
3334 />
3435 </ Suspense >
3536 </ StrictMode >
Original file line number Diff line number Diff line change 11/// <reference types="vite/client" />
2+ /// <reference types="vite-plugin-svgr/client" />
Original file line number Diff line number Diff line change 11import { defineConfig } from "vite" ;
22import react from "@vitejs/plugin-react" ;
3+ import svgr from "vite-plugin-svgr" ;
34
45// https://vite.dev/config/
56export default defineConfig ( {
6- plugins : [ react ( ) ] ,
7+ plugins : [ react ( ) , svgr ( ) ] ,
78 esbuild : {
89 supported : {
910 "top-level-await" : true ,
You can’t perform that action at this time.
0 commit comments