converted frontend from tailwind to material-ui using AI
							parent
							
								
									3e5e728d92
								
							
						
					
					
						commit
						70b690ab9d
					
				
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								| @ -1,6 +0,0 @@ | ||||
| export default { | ||||
|   plugins: { | ||||
|     tailwindcss: {}, | ||||
|     autoprefixer: {}, | ||||
|   }, | ||||
| } | ||||
| @ -1,27 +1,40 @@ | ||||
| import { useLocation } from "preact-iso"; | ||||
| import { AppBar, Toolbar, Button, Box } from "@mui/material"; | ||||
| import { styled } from "@mui/system"; | ||||
| 
 | ||||
| const StyledToolbar = styled(Toolbar)({ | ||||
|   display: "flex", | ||||
|   justifyContent: "center", | ||||
|   backgroundColor: "#E0E7FF", // Indigo-200 equivalent
 | ||||
| }); | ||||
| 
 | ||||
| const StyledButton = styled(Button)(({ theme, active }) => ({ | ||||
|   color: theme.palette.text.primary, | ||||
|   fontWeight: active ? "bold" : "normal", | ||||
|   textDecoration: active ? "underline" : "none", | ||||
| })); | ||||
| 
 | ||||
| export function Header() { | ||||
|   const { url } = useLocation(); | ||||
| 
 | ||||
|   return ( | ||||
|     <header class="flex flex-row justify-center"> | ||||
|       <nav class="flex flex-row justify-center text-lg gap-4 max-w-5xl py-2 px-3 rounded-full  bg-indigo-200"> | ||||
|         <a | ||||
|           href="/" | ||||
|           class={ | ||||
|             (url === "/" || url === "/historical-calendar-prices") && | ||||
|             "underline font-bold" | ||||
|           } | ||||
|         > | ||||
|           Historical Calendar Prices | ||||
|         </a> | ||||
|         <a | ||||
|           href="/calendar-optimizer" | ||||
|           class={url === "/calendar-optimizer" && "underline font-bold"} | ||||
|         > | ||||
|           Calendar Optimizer | ||||
|         </a> | ||||
|       </nav> | ||||
|     </header> | ||||
|     <AppBar position="static" elevation={0}> | ||||
|       <StyledToolbar> | ||||
|         <Box sx={{ display: "flex", gap: 2 }}> | ||||
|           <StyledButton | ||||
|             href="/" | ||||
|             active={url === "/" || url === "/historical-calendar-prices"} | ||||
|           > | ||||
|             Historical Calendar Prices | ||||
|           </StyledButton> | ||||
|           <StyledButton | ||||
|             href="/calendar-optimizer" | ||||
|             active={url === "/calendar-optimizer"} | ||||
|           > | ||||
|             Calendar Optimizer | ||||
|           </StyledButton> | ||||
|         </Box> | ||||
|       </StyledToolbar> | ||||
|     </AppBar> | ||||
|   ); | ||||
| } | ||||
| } | ||||
| @ -1,32 +1,37 @@ | ||||
| import _ from "./env"; | ||||
| import { render } from "preact"; | ||||
| import { LocationProvider, Router, Route } from "preact-iso"; | ||||
| import { ThemeProvider, createTheme } from '@mui/material/styles'; | ||||
| import CssBaseline from '@mui/material/CssBaseline'; | ||||
| 
 | ||||
| import { Header } from "./components/Header.jsx"; | ||||
| import { CalendarOptimizer } from "./pages/CalendarOptimizer.js"; | ||||
| import { NotFound } from "./pages/_404.jsx"; | ||||
| // import './style.css';
 | ||||
| import { HistoricalCalendarPrices } from "./pages/HistoricalCalendarPrices.js"; | ||||
| 
 | ||||
| const theme = createTheme(); | ||||
| 
 | ||||
| export function App() { | ||||
|   return ( | ||||
|     <LocationProvider> | ||||
|       <div class="flex flex-col justify-start gap-4"> | ||||
|         <Header /> | ||||
|         <main> | ||||
|           <Router> | ||||
|             <Route path="/" component={HistoricalCalendarPrices} /> | ||||
|             <Route path="/calendar-optimizer" component={CalendarOptimizer} /> | ||||
|             <Route | ||||
|               path="/historical-calendar-prices" | ||||
|               component={HistoricalCalendarPrices} | ||||
|             /> | ||||
|             <Route default component={NotFound} /> | ||||
|           </Router> | ||||
|         </main> | ||||
|       </div> | ||||
|     </LocationProvider> | ||||
|     <ThemeProvider theme={theme}> | ||||
|       <CssBaseline /> | ||||
|       <LocationProvider> | ||||
|         <div> | ||||
|           <Header /> | ||||
|           <main> | ||||
|             <Router> | ||||
|               <Route path="/" component={HistoricalCalendarPrices} /> | ||||
|               <Route path="/calendar-optimizer" component={CalendarOptimizer} /> | ||||
|               <Route | ||||
|                 path="/historical-calendar-prices" | ||||
|                 component={HistoricalCalendarPrices} | ||||
|               /> | ||||
|               <Route default component={NotFound} /> | ||||
|             </Router> | ||||
|           </main> | ||||
|         </div> | ||||
|       </LocationProvider> | ||||
|     </ThemeProvider> | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| render(<App />, document.getElementById("app")); | ||||
| render(<App />, document.getElementById("app")); | ||||
| @ -1,13 +0,0 @@ | ||||
| /** @type {import('tailwindcss').Config} */ | ||||
| export default { | ||||
|   content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], | ||||
|   theme: { | ||||
|     extend: { | ||||
|       width: { | ||||
|         128: "32rem", | ||||
|         160: "40rem", | ||||
|       }, | ||||
|     }, | ||||
|   }, | ||||
|   plugins: [], | ||||
| }; | ||||
					Loading…
					
					
				
		Reference in New Issue