|
1 | | -import MicIcon from '../../components/micicon'; |
2 | | -import styles from './home.module.scss'; |
| 1 | +import { DesignConfiguration, type Design } from "store/design"; |
| 2 | +import MicIcon from "../../components/micicon"; |
| 3 | +import styles from "./home.module.scss"; |
| 4 | +import type { Route } from "../+types/root"; |
| 5 | + |
| 6 | +export async function loader({ params }: Route.LoaderArgs) { |
| 7 | + const designConfig = new DesignConfiguration(); |
| 8 | + try { |
| 9 | + const defaultDesign = await designConfig.fetchDefaultDesign(); |
| 10 | + return defaultDesign; |
| 11 | + } catch (error) { |
| 12 | + console.error("Error fetching default design:", error); |
| 13 | + } |
| 14 | + // You can perform any data fetching or initialization here |
| 15 | + // For example, you might want to fetch user data or initial settings |
| 16 | + const design: Design = { |
| 17 | + id: "default", |
| 18 | + background: "/images/background.jpg", |
| 19 | + default: true, |
| 20 | + logo: "", |
| 21 | + title: "BuildEvents", |
| 22 | + sub_title: "by Contoso", |
| 23 | + description: "Making Things Happen since 1935", |
| 24 | + }; |
| 25 | + |
| 26 | + return design; |
| 27 | +} |
| 28 | + |
| 29 | +export function meta({ data }: Route.MetaArgs) { |
| 30 | + if (!data) { |
| 31 | + return [ |
| 32 | + { title: "BuildEvents by Contoso" }, |
| 33 | + { name: "description", content: "Making Things Happen since 1935" }, |
| 34 | + ]; |
| 35 | + } |
| 36 | + const title = `${data["title"] || "BuildEvents"} ${ |
| 37 | + data["sub_title"] || "by Contoso" |
| 38 | + }`; |
| 39 | + const description = data["description"] || "Making Things Happen since 1935"; |
| 40 | + return [{ title: title }, { name: "description", content: description }]; |
| 41 | +} |
| 42 | + |
| 43 | +export default function Home({ loaderData }: Route.ComponentProps) { |
| 44 | + const { background, logo, title, sub_title, description } = |
| 45 | + loaderData as unknown as Design; |
| 46 | + |
3 | 47 |
|
4 | | -export default function Landing() { |
5 | 48 | return ( |
6 | | - <div className={styles.landing}> |
| 49 | + <div |
| 50 | + className={styles.landing} |
| 51 | + style={{ backgroundImage: `url('${background}')` }} |
| 52 | + > |
7 | 53 | <div className={styles.root}> |
8 | 54 | <div className={styles.container}> |
9 | | - <h1>What can we<br />start working on?</h1> |
| 55 | + <h1> |
| 56 | + What can we |
| 57 | + <br /> |
| 58 | + start working on? |
| 59 | + </h1> |
10 | 60 | <p>Talk through your ideas and let's make them reality.</p> |
11 | 61 | </div> |
12 | 62 | <a href="/app"> |
13 | 63 | <div className={styles.micContainer}> |
14 | | - <MicIcon |
| 64 | + <MicIcon |
15 | 65 | className={styles.micIcon} |
16 | 66 | role="button" |
17 | 67 | aria-label="Start recording" |
|
0 commit comments