From 55447a212afa53ea0b90e82f6d25591d2eb3c1ee Mon Sep 17 00:00:00 2001 From: Gleb Galkin Date: Tue, 18 Dec 2018 10:13:30 +0100 Subject: [PATCH] feat(unsplash): First screen with mocked data added Related to #142 --- sandbox/pages/index/index.tsx | 95 +++++++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 22 deletions(-) diff --git a/sandbox/pages/index/index.tsx b/sandbox/pages/index/index.tsx index 0355497..f23c8f3 100644 --- a/sandbox/pages/index/index.tsx +++ b/sandbox/pages/index/index.tsx @@ -1,29 +1,80 @@ -import React from "react"; +import React, { Component } from "react"; import Router from "next/router"; -import { Container, Header, Button } from "semantic-ui-react"; +import { Container, Header, Divider, Card } from "semantic-ui-react"; + +export interface IImage { + url: string; +} export interface IMainPage { onImageSelect: (imageUrl: string) => void; + images: Array; } -const MainPage: React.SFC = ({ onImageSelect }) => ( -
- -
- Select Image -
- -
-
-); +class MainPage extends Component { + static async getInitialProps() { + // TODO API call to Unsplash here + const images = [ + { + url: + "https://images.unsplash.com/photo-1544868501-b2f493d76e35?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544617724-2d30b41f5d05?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544868501-b2f493d76e35?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544617724-2d30b41f5d05?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544868501-b2f493d76e35?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544617724-2d30b41f5d05?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544868501-b2f493d76e35?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + }, + { + url: + "https://images.unsplash.com/photo-1544617724-2d30b41f5d05?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60" + } + ]; + + return { images }; + } + + render() { + const { onImageSelect, images } = this.props; + return ( +
+ +
+ Select Image +
+
+
+ ); + } +} export default MainPage;