Skip to content
This repository has been archived by the owner on Jun 30, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #14 from kevgathuku/landing-elm
Port landing page component to Elm
  • Loading branch information
kevgathuku committed May 23, 2017
2 parents ce1de0b + 4a349f0 commit 80ddc78
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 81 deletions.
47 changes: 47 additions & 0 deletions src/components/Landing.elm
@@ -0,0 +1,47 @@
module Landing exposing (..)

import Html exposing (..)
import Html.Attributes exposing (..)


type alias Model =
{ authLink : String
}


model : Model
model =
{ authLink = "/auth" }


update msg model =
model


main =
beginnerProgram { model = model, view = view, update = update }


view : Model -> Html msg
view model =
div [ id "hero" ]
[ div [ class "container", id "hero-text-container" ]
[ div [ class "row" ]
[ div [ class "col s12 center-align" ]
[ h1 [ id "hero-title" ]
[ span [ class "bold" ] [ text "Docue " ]
, span [ class "thin" ] [ text "is the simplest way for" ]
, br [] []
, span [ class "thin" ] [ text "you to manage your documents online" ]
]
]
]
, div [ class "row" ]
[ div [ class "col s12" ]
[ div [ class "center-align" ]
[ a [ class "btn btn-large create-list-link hero-btn", href model.authLink ] [ text "Get Started" ]
]
]
]
]
]
13 changes: 13 additions & 0 deletions src/components/Landing/Landing.jsx
@@ -0,0 +1,13 @@
import React from 'react';
import Elm from 'react-elm-components';
import { Landing } from '../Landing.elm';

// Requires the CSS for it to be included in the final output
import 'react-select/dist/react-select.css';
import '../../styles/style.css';

export default class Main extends React.PureComponent {
render() {
return <Elm src={Landing} />;
}
}
20 changes: 0 additions & 20 deletions src/components/Landing/__tests__/Landing-test.js

This file was deleted.

41 changes: 0 additions & 41 deletions src/components/Landing/index.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -13,7 +13,7 @@ import CreateDocument from './components/CreateDocument/index.jsx';
import CreateRole from './components/CreateRole/index.jsx';
import DocumentPage from './components/DocumentPage/index.jsx';
import Dashboard from './components/Dashboard/index.jsx';
import Landing from './components/Landing/index.jsx';
import Landing from './components/Landing/Landing.jsx';
import Profile from './components/Profile/Profile.jsx';
import Main from './components/Landing/Main.jsx';
import NotFound from './components/NotFound/NotFound.jsx';
Expand Down
53 changes: 34 additions & 19 deletions tests/Tests.elm
Expand Up @@ -2,28 +2,43 @@ module Tests exposing (..)

import Test exposing (..)
import Expect
import NotFound
import Html
import Html.Attributes exposing (class)
import Test.Html.Query as Query
import Test.Html.Selector exposing (text, tag)
import Test.Html.Selector exposing (attribute, text, tag)
import Landing
import NotFound


all : Test
all =
describe "Sample Test Suite"
[ describe "Not Found"
[ test "Correctly Renders Model Content" <|
\() ->
NotFound.view "Nothing"
|> Query.fromHtml
|> Query.find [ tag "h2" ]
|> Query.has [ text "Nothing" ]
, test "Renders static text" <|
\() ->
NotFound.view "Nothing"
|> Query.fromHtml
|> Query.find [ tag "p" ]
|> Query.has [ text "Sorry. This is not the page you were looking for" ]
]
describe "Docue Test Suite"
[ notFound, landing ]


notFound : Test
notFound =
describe "Not Found"
[ test "Correctly Renders Model Content" <|
\() ->
NotFound.view "Nothing"
|> Query.fromHtml
|> Query.find [ tag "h2" ]
|> Query.has [ text "Nothing" ]
, test "Renders static text" <|
\() ->
NotFound.view "Nothing"
|> Query.fromHtml
|> Query.find [ tag "p" ]
|> Query.has [ text "Sorry. This is not the page you were looking for" ]
]


landing : Test
landing =
describe "Landing"
[ test "Correctly Renders Model Content" <|
\() ->
Landing.view { authLink = "/authenticate" }
|> Query.fromHtml
|> Query.find [ attribute "href" "/authenticate" ]
|> Query.has [ text "Get Started" ]
]

0 comments on commit 80ddc78

Please sign in to comment.