play around with "reusable modules"
parent
7b1ee76d48
commit
b8e3633ae9
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,75 @@
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #161616;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
video {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
select,
|
||||
footer,
|
||||
.downloadList {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
display: block;
|
||||
width: 960px;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
select {
|
||||
background-color: #333;
|
||||
color: #ccc;
|
||||
border: 1px solid #555;
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
footer > a {
|
||||
font-size: 0.8em;
|
||||
margin-left: 1em;
|
||||
padding: 0.1em 0.8em;
|
||||
background-color: #60b5cc;
|
||||
color: #333;
|
||||
border-radius: 3px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
footer > a:hover {
|
||||
background-color: #cc60b6;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.downloadList:before {
|
||||
content: "Direct Download";
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
margin-bottom: 1em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.downloadList {
|
||||
margin-top: 2em;
|
||||
width: 500px;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.downloadList > a {
|
||||
color: #60b5cc;
|
||||
display: list-item;
|
||||
margin-top: 0.2em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.downloadList > a:hover {
|
||||
color: #ccc;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
module Dropdown exposing (..)
|
||||
|
||||
import Html
|
||||
import Html.Attributes
|
||||
import Html.Events as Events
|
||||
|
||||
type alias Option =
|
||||
{ value : String
|
||||
, display : String
|
||||
}
|
||||
|
||||
type alias Config msg =
|
||||
{ options : List Option
|
||||
, default : Option
|
||||
, selectEvent : String -> msg
|
||||
}
|
||||
|
||||
view : Config msg -> Html.Html msg
|
||||
view config = Html.select [ Events.onInput config.selectEvent ] <|
|
||||
makeOption config.default
|
||||
:: List.map makeOption config.options
|
||||
|
||||
makeOption : Option -> Html.Html msg
|
||||
makeOption option =
|
||||
Html.option
|
||||
[ Html.Attributes.value option.value ]
|
||||
[ Html.text option.display ]
|
@ -0,0 +1,19 @@
|
||||
module Flags exposing (..)
|
||||
|
||||
import Video
|
||||
|
||||
type alias Flags =
|
||||
{ debug : Bool
|
||||
, withDownload : Bool
|
||||
, extentions : List Video.FileFormat
|
||||
}
|
||||
|
||||
|
||||
debugEnabled : Flags -> Bool
|
||||
debugEnabled flags =
|
||||
flags.debug
|
||||
|
||||
|
||||
withDownload : Flags -> Bool
|
||||
withDownload flags =
|
||||
flags.withDownload
|
@ -0,0 +1,21 @@
|
||||
module Model exposing (..)
|
||||
|
||||
import Flags exposing (Flags, withDownload)
|
||||
import Video
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ selected : Maybe String
|
||||
, videos : List Video.Video
|
||||
, extensions : List Video.FileFormat
|
||||
, withDownload : Bool
|
||||
}
|
||||
|
||||
|
||||
initialState : Flags -> Model
|
||||
initialState flags =
|
||||
{ selected = Nothing
|
||||
, videos = []
|
||||
, extensions = flags.extentions
|
||||
, withDownload = withDownload flags
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
module Types exposing (..)
|
||||
|
||||
import Video
|
||||
|
||||
|
||||
type alias Flags =
|
||||
{ debug : Bool
|
||||
, extentions : List Video.FileFormat
|
||||
}
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ selected : Maybe String
|
||||
, videos : List Video.Video
|
||||
, extensions : List Video.FileFormat
|
||||
, withDownload : Bool
|
||||
}
|
||||
|
||||
|
||||
videos : Model -> List Video.Video
|
||||
videos model =
|
||||
model.videos
|
||||
|
||||
|
||||
|
||||
-- These functions may seem useless, but that way it's easier to swap out
|
||||
-- from flags without changing the init function.
|
||||
|
||||
|
||||
debugEnabled : Flags -> Bool
|
||||
debugEnabled flags =
|
||||
flags.debug
|
||||
|
||||
|
||||
withDownload : Flags -> Bool
|
||||
withDownload flags =
|
||||
flags.debug
|
Loading…
Reference in New Issue