Skip to content

Commit

Permalink
Add separate CSS file
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryce Hill committed Nov 6, 2018
1 parent d9dd55f commit 4c4d120
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 22 deletions.
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Main</title>
<link rel="stylesheet" href="styles.css">
<script src="main.js"></script>
</head>
<body>
<script>var app = Elm.Main.init();</script>
</body>
</html>
40 changes: 18 additions & 22 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Browser exposing (Document)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
import Browser exposing (Document)
import Html.Attributes exposing (style)
import Html.Attributes exposing (class, style)


main : Program () Model Msg
Expand Down Expand Up @@ -60,25 +60,21 @@ update msg model =

view : Maybe Color -> Document Msg
view mc =
{ title = ""
, body =
[ case mc of
Just color ->
div
[ style "backgroundColor" color
, style "height" "100vh"
, style "width" "100vw"
, style "display" "flex"
, style "justify-content" "center"
, style "align-items" "center"
, style "text-align" "center"
, style "font-size" "40px"
, style "color" "white"
, onClick ChangeColor
case mc of
Just color ->
{ title = "CSS Color : " ++ color
, body =
[ div
[ class "root"
, style "backgroundColor" color
]
[ div [] [ text color ] ]

Nothing ->
div [] [ div [ onClick ChangeColor ] [ text "No" ] ]
]
}
[ div [ class "text", onClick ChangeColor ] [ text color ] ]
]
}

Nothing ->
{ title = "CSS Color"
, body =
[ div [] [ div [ onClick ChangeColor ] [] ]
]
}
28 changes: 28 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

body {
margin: 0;
padding: 0;
}

.root {
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-family: "Open Sans", Helvetica, sans-serif;
}

/**
* TODO: Add Text Animation, like a wiggle?
* Animate colors and/or text when transitioning
*/

.text {
cursor: pointer;
font-size: 6em;
color: white;
letter-spacing: 5px;
font-weight: 100;
}

0 comments on commit 4c4d120

Please sign in to comment.