From 2b95ab81c1c98696adbb0b066acb829459d2bc84 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 13 Sep 2019 22:43:07 -0600 Subject: [PATCH] Start designing logged out home view --- app/views/home/controller.js | 14 +++---- app/views/home/index.js | 34 +++------------ app/views/home/loggedOut.js | 81 ++++++++++++++++++++++++++++++++++++ app/views/home/styles.scss | 8 ---- 4 files changed, 93 insertions(+), 44 deletions(-) create mode 100644 app/views/home/loggedOut.js delete mode 100644 app/views/home/styles.scss diff --git a/app/views/home/controller.js b/app/views/home/controller.js index e47c963..7ba5dac 100644 --- a/app/views/home/controller.js +++ b/app/views/home/controller.js @@ -5,11 +5,8 @@ export class HomeController extends ViewController { // Super passes state, view name, and default state to ViewController, // which stores state in this.appState and the view controller's state to this.state super(state, 'home', { - messages: [ - 'hello', - 'test', - 'yay', - ], + recentReviews: [], + recentUpdates: [], }); // If using controller methods in an input's onchange or onclick instance, @@ -17,7 +14,10 @@ export class HomeController extends ViewController { // or use `onclick=${() => controller.submit()}` to maintain the 'this' of the class instead. } - get messages() { - return [...this.state.messages]; + get recentReviews() { + return [...this.state.recentReviews]; + } + get recentUpdates() { + return [...this.state.recentUpdates]; } } \ No newline at end of file diff --git a/app/views/home/index.js b/app/views/home/index.js index a1a1f25..af49c13 100644 --- a/app/views/home/index.js +++ b/app/views/home/index.js @@ -1,42 +1,18 @@ import html from 'choo/html'; -import './styles.scss'; // Creates a separate CSS file, but allows better code splitting. -// We'll see if code splitting is worth it in the end or if we should combine everything into `src/index.scss` import { HomeController } from './controller'; // The controller for this view, where processing should happen. +import { loggedOutView } from './loggedOut'; // This is the view function that is exported and used in the view manager. export const homeView = (state, emit) => { const controller = new HomeController(state); - const { i18n } = controller; // Returning an array in a view allows non-shared parent HTML elements. // This one doesn't have the problem right now, but it's good to remember. return [ - html`
-

${i18n.__('home.subtitle')}

- -
-
-
-
-

${i18n.__('home.temp_left')}

-
-
-
-
-
-
-

${i18n.__('home.temp_right')}

-
-
-
-
- -
- ${controller.messages.map(message => { - return html`

${message}

`; - })} -
-
`, + (!controller.isLoggedIn + ? loggedOutView(controller, emit) + : html`

lol wut how are u logged in

` + ), ]; } \ No newline at end of file diff --git a/app/views/home/loggedOut.js b/app/views/home/loggedOut.js new file mode 100644 index 0000000..91824e3 --- /dev/null +++ b/app/views/home/loggedOut.js @@ -0,0 +1,81 @@ +import html from 'choo/html'; + +export const loggedOutView = (homeController, emit) => { + return [ + html`
+

Read Together

+
+
+
+
+ + + +
+
+ Keep track of books you've read, want to read, and are currently reading. +
+
+
+
+
+
+ + + +
+
+ Share your thoughts about what you're reading and see what your friends think of their books. +
+
+
+
+
+
+ + + +
+
+ Read, rate, and recommmend books or something. It'll be cool. +
+
+
+
+
`, + html`
+

Join the Community

+
+
+
+
+

Recent Reviews

+ +
+
+ ${homeController.recentReviews.map(review => reviewCard(review))} +
+
+
+
+
+
+

Recent Updates

+ +
+
+ ${homeController.recentUpdates.map(review => reviewCard(review))} +
+
+
+
+
`, + html`
+ Join Now! +
`, + ]; +} \ No newline at end of file diff --git a/app/views/home/styles.scss b/app/views/home/styles.scss deleted file mode 100644 index e92a2b3..0000000 --- a/app/views/home/styles.scss +++ /dev/null @@ -1,8 +0,0 @@ -.test { - background-color: #dddddd; - padding: 10px; - - p { - border: 1px solid #444444; - } -} \ No newline at end of file