From d7d4f399a2fb77bda46b7a590183b1b127a85897 Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Sat, 20 Jul 2024 00:15:05 +0200 Subject: [PATCH] improve homepage layout --- dist/index.css | 12 ++++++ dist/index.js | 11 ++++- src/View/homePage.css | 15 +++++++ src/View/homePage.tsx | 87 ++++++++++++++++++++++++++-------------- src/View/translations.ts | 3 ++ 5 files changed, 95 insertions(+), 33 deletions(-) diff --git a/dist/index.css b/dist/index.css index 431cfbd4..8354175a 100644 --- a/dist/index.css +++ b/dist/index.css @@ -15,6 +15,18 @@ min-width: 100%; scroll-snap-align: center; } +@media (max-width: 640px) { + #home-page > div { + padding-left: 0px; + padding-right: 0px; + padding-bottom: 0px; + } + #home-page > div > div { + height: 100%; + overflow: scroll; + padding: var(--content-padding); + } +} @media (min-width: 640px) { #home-page #overview-section { width: 20rem; diff --git a/dist/index.js b/dist/index.js index 8021528a..06904e25 100644 --- a/dist/index.js +++ b/dist/index.js @@ -274,7 +274,9 @@ overviewHeadline: "Overview", statusHeadline: "Status", settingsButton: "Settings", + scrollToChatButton: "Chats", /// + backToOverviewAudioLabel: "go back to overview", chatsHeadline: "Chats", addChatAudioLabel: "name of new chat", addChatPlaceholder: "Add chat", @@ -293,7 +295,8 @@ // src/View/homePage.tsx function HomePage() { - return /* @__PURE__ */ createElement("article", { id: "home-page" }, /* @__PURE__ */ createElement("header", null, /* @__PURE__ */ createElement("span", null, translations.homePage.appName)), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("div", { id: "overview-section" }, /* @__PURE__ */ createElement("h2", null, translations.homePage.overviewHeadline), /* @__PURE__ */ createElement("div", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "cell_tower"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("h3", null, translations.homePage.statusHeadline))), /* @__PURE__ */ createElement("button", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "settings"), /* @__PURE__ */ createElement("div", null, translations.homePage.settingsButton))), /* @__PURE__ */ createElement("div", { id: "chat-section" }, /* @__PURE__ */ createElement("h2", null, translations.homePage.chatsHeadline), /* @__PURE__ */ createElement("div", { class: "flex-row width-input" }, /* @__PURE__ */ createElement( + const overviewSection = /* @__PURE__ */ createElement("div", { id: "overview-section" }, /* @__PURE__ */ createElement("h2", null, translations.homePage.overviewHeadline), /* @__PURE__ */ createElement("div", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "cell_tower"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("b", null, translations.homePage.statusHeadline))), /* @__PURE__ */ createElement("button", { class: "tile flex-no" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "settings"), /* @__PURE__ */ createElement("div", null, translations.homePage.settingsButton)), /* @__PURE__ */ createElement("div", { class: "mobile-only" }, /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("div", { class: "flex-row justify-end" }, /* @__PURE__ */ createElement("button", { class: "ghost width-50", "on:click": scrollToChat }, translations.homePage.scrollToChatButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "arrow_forward"))))); + const chatSection = /* @__PURE__ */ createElement("div", { id: "chat-section" }, /* @__PURE__ */ createElement("h2", null, translations.homePage.chatsHeadline), /* @__PURE__ */ createElement("div", { class: "flex-row width-input" }, /* @__PURE__ */ createElement( "input", { placeholder: translations.homePage.addChatPlaceholder, @@ -306,7 +309,11 @@ "aria-label": translations.homePage.addChatButton }, /* @__PURE__ */ createElement("span", { class: "icon" }, "add") - ))))); + ))); + function scrollToChat() { + chatSection.scrollIntoView(); + } + return /* @__PURE__ */ createElement("article", { id: "home-page" }, /* @__PURE__ */ createElement("header", null, /* @__PURE__ */ createElement("span", null, translations.homePage.appName)), /* @__PURE__ */ createElement("div", null, overviewSection, chatSection)); } // src/Model/Utility/typeSafety.ts diff --git a/src/View/homePage.css b/src/View/homePage.css index da90bd5e..4331c954 100644 --- a/src/View/homePage.css +++ b/src/View/homePage.css @@ -21,6 +21,21 @@ scroll-snap-align: center; } +@media (max-width: 640px) { + #home-page > div { + padding-left: 0px; + padding-right: 0px; + padding-bottom: 0px; + } + + #home-page > div > div { + height: 100%; + overflow: scroll; + + padding: var(--content-padding) + } +} + @media (min-width: 640px) { #home-page #overview-section { width: 20rem; diff --git a/src/View/homePage.tsx b/src/View/homePage.tsx index 014adf0f..9d7560a8 100644 --- a/src/View/homePage.tsx +++ b/src/View/homePage.tsx @@ -5,43 +5,68 @@ import * as React from "bloatless-react"; import { translations } from "./translations"; export function HomePage() { + // sections + const overviewSection = ( +
+

{translations.homePage.overviewHeadline}

+ +
+ cell_tower +
+ {translations.homePage.statusHeadline} +
+
+ + +
+
+ +
+ +
+
+
+ ); + + const chatSection = ( +
+

{translations.homePage.chatsHeadline}

+ +
+ + +
+
+ ); + + // methods + function scrollToChat() { + chatSection.scrollIntoView(); + } + + // final return (
{translations.homePage.appName}
-
-

{translations.homePage.overviewHeadline}

- -
- cell_tower -
-

{translations.homePage.statusHeadline}

-
-
- -
- -
-

{translations.homePage.chatsHeadline}

- -
- - -
-
+ {overviewSection} + {chatSection}
); diff --git a/src/View/translations.ts b/src/View/translations.ts index 1858faf9..63120e7c 100644 --- a/src/View/translations.ts +++ b/src/View/translations.ts @@ -13,8 +13,11 @@ const englishTranslations = { statusHeadline: "Status", settingsButton: "Settings", + scrollToChatButton: "Chats", + /// + backToOverviewAudioLabel: "go back to overview", chatsHeadline: "Chats", addChatAudioLabel: "name of new chat",