import React, { useState } from "react"; import { App, Button, Flex, Input, NavView, Ring, ScrollPane, TabView, TCPClient, TextBlock, ThemeRelativeElement, theming, themingThemes, Toggle } from "../../../../src/main"; import "./styles/globals.scss"; const ws = new TCPClient({ port: 4040, ssl: false }); ws.on("message", (msg, channel) => { console.log(`MSG = ${JSON.stringify(msg)} CHANNEL = ${channel}`); }); ws.start().then(() => { console.log("Connected"); }).catch((errorCode) => { console.log("[ WS ] Failed to connect: (" + errorCode + ")"); console.log("[ WS ] " + ws.exitError?.code); }); export default React.forwardRef((props: any, ref: any) => { const [ tabContents, setTabContents ] = useState(null); const [ currentTab, setCurrentTab ] = useState("Buttons"); const [ useSideBar, setUseSideBar ] = useState(true); const [ winTitle, setSetWinTitle ] = useState("LuxJS Demo #1"); const tabs = [ { name: "Buttons", element: ( <> Accent Style


Default Style


Outline Style


Text Style
) }, { name: "Headers", element: ( <> Text Text Text Text Text Text ) }, { name: "Input", element: ( <> Generic

Placeholder

Custom Icon
) }, { name: "Switches", element: ( ) } ] return ( {} }, { label: "Home", action: () => {} }, { label: "Home", action: () => {} }, { label: "Home", action: () => {} }, { label: "Home", action: () => {} }, { label: "Home", action: () => {} }, { label: "Home", action: () => {} }, ] } : undefined} sideRail={[ { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, { label: "Test", icon: } dark={} /> }, ]}> Settings Light Mode { if (light) { theming.loadTheme(themingThemes.defaultLightTheme.author, themingThemes.defaultLightTheme.name); return; } theming.loadTheme(themingThemes.defaultDarkTheme.author, themingThemes.defaultDarkTheme.name); }} /> Side Bar { setUseSideBar(sb); }} /> Window Title { setSetWinTitle(val); }} placeHolder="Window's title" /> Tests ) }, { label: "Second", content: ( <> ) } ]} /> Light Mode { if (light) { theming.loadTheme(themingThemes.defaultLightTheme.author, themingThemes.defaultLightTheme.name); return; } theming.loadTheme(themingThemes.defaultDarkTheme.author, themingThemes.defaultDarkTheme.name); }} /> Send WS Message { if (val) { console.log(ws.alive); if (ws.alive) { ws.send("main", { msg: { target: "button" } }) } } }} />
{ tabs.map(tab => { return ( ) }) }
{ tabs.map(tab => { if (tab.name == currentTab) { return tab.element; } }) }
); });