import { Component, JSXElement, createSignal } from 'solid-js'; import styles from './css/App.module.css'; import { Country } from './country/Country'; import { Cities } from './cities/Cities'; import { Database } from './database/Database'; import { Station } from './station/Station'; import { apiHost } from './consts'; console.log("env:", import.meta.env.MODE); console.log("api host:", apiHost); const App: Component = () => { const pages: [string, () => JSXElement][] = [ ["station", () => ], ["cities", () => ], ["latvia", () => ], ["database", () => ], ]; const [getPageTitle, setPageTitle] = createSignal("station"); const getPageContent = () => { const page = pages.find(p => p[0] === getPageTitle()); return page ? page[1]() :
Page not found!
; } const getActiveCSS = (pageTitle: string) => { return getPageTitle() === pageTitle ? styles.active : ""; } return (
    { pages.map(([pageTitle]) =>
  • setPageTitle(pageTitle)} > {pageTitle}
  • )}
{ getPageContent() }
); }; export default App;