Update part1, part2, and part3
This commit is contained in:
@@ -1,84 +1,79 @@
|
||||
module Main (..) where
|
||||
module Main exposing (..)
|
||||
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ query : String
|
||||
, results : List SearchResult
|
||||
}
|
||||
{ query : String
|
||||
, results : List SearchResult
|
||||
}
|
||||
|
||||
|
||||
type alias SearchResult =
|
||||
{ id : ResultId
|
||||
, name : String
|
||||
, stars : Int
|
||||
}
|
||||
{ id : ResultId
|
||||
, name : String
|
||||
, stars : Int
|
||||
}
|
||||
|
||||
|
||||
type alias ResultId =
|
||||
Int
|
||||
Int
|
||||
|
||||
|
||||
{-| TODO add a type annotation to this value
|
||||
-}
|
||||
model =
|
||||
{ query = "tutorial"
|
||||
, results =
|
||||
[ { id = 1
|
||||
, name = "TheSeamau5/elm-checkerboardgrid-tutorial"
|
||||
, stars = 66
|
||||
}
|
||||
, { id = 2
|
||||
, name = "grzegorzbalcerek/elm-by-example"
|
||||
, stars = 41
|
||||
}
|
||||
, { id = 3
|
||||
, name = "sporto/elm-tutorial-app"
|
||||
, stars = 35
|
||||
}
|
||||
, { id = 4
|
||||
, name = "jvoigtlaender/Elm-Tutorium"
|
||||
, stars = 10
|
||||
}
|
||||
, { id = 5
|
||||
, name = "sporto/elm-tutorial-assets"
|
||||
, stars = 7
|
||||
}
|
||||
]
|
||||
}
|
||||
{ query = "tutorial"
|
||||
, results =
|
||||
[ { id = 1
|
||||
, name = "TheSeamau5/elm-checkerboardgrid-tutorial"
|
||||
, stars = 66
|
||||
}
|
||||
, { id = 2
|
||||
, name = "grzegorzbalcerek/elm-by-example"
|
||||
, stars = 41
|
||||
}
|
||||
, { id = 3
|
||||
, name = "sporto/elm-tutorial-app"
|
||||
, stars = 35
|
||||
}
|
||||
, { id = 4
|
||||
, name = "jvoigtlaender/Elm-Tutorium"
|
||||
, stars = 10
|
||||
}
|
||||
, { id = 5
|
||||
, name = "sporto/elm-tutorial-assets"
|
||||
, stars = 7
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
{-| TODO add a type annotation to this function
|
||||
-}
|
||||
view model =
|
||||
div
|
||||
[ class "content" ]
|
||||
[ header
|
||||
[]
|
||||
[ h1 [] [ text "ElmHub" ]
|
||||
, span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
|
||||
div [ class "content" ]
|
||||
[ header []
|
||||
[ h1 [] [ text "ElmHub" ]
|
||||
, span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
|
||||
]
|
||||
, ul [ class "results" ]
|
||||
[{- TODO use model.results and viewSearchResults to display results -}]
|
||||
]
|
||||
, ul
|
||||
[ class "results" ]
|
||||
[{- TODO use model.results and viewSearchResults to display results -}]
|
||||
]
|
||||
|
||||
|
||||
{-| TODO add a type annotation to this function
|
||||
-}
|
||||
viewSearchResult result =
|
||||
li
|
||||
[]
|
||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
||||
, a
|
||||
[ href ("https://github.com/" ++ result.name), target "_blank" ]
|
||||
[ text result.name ]
|
||||
]
|
||||
li []
|
||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
||||
, a [ href ("https://github.com/" ++ result.name), target "_blank" ]
|
||||
[ text result.name ]
|
||||
]
|
||||
|
||||
|
||||
{-| TODO add a type annotation to this value
|
||||
-}
|
||||
main =
|
||||
view model
|
||||
view model
|
||||
|
||||
Reference in New Issue
Block a user