Skip to content

Commit fbaf93a

Browse files
committed
[hello-elm] CSSを適用してみる
1 parent b104e15 commit fbaf93a

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

hello-elm/index.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
7+
<title>Hello Elm!</title>
8+
9+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
10+
<script src="main.js"></script>
11+
</head>
12+
<body>
13+
<script>var app = Elm.Main.init();</script>
14+
</body>
15+
</html>

hello-elm/src/Main.elm

+27-4
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,33 @@ view : Model -> Browser.Document Msg
8181
view model =
8282
{ title = "URL Interceptor"
8383
, body =
84-
[ text "The current URL is: "
85-
, b [] [ text (Url.toString model.url) ]
86-
, ul []
84+
pageContainer
85+
[ mainHeader model
86+
, mainContents
87+
]
88+
}
89+
90+
91+
pageContainer : List (Html Msg) -> List (Html Msg)
92+
pageContainer contents =
93+
[ div [ class "container" ] contents ]
94+
95+
96+
mainHeader : Model -> Html Msg
97+
mainHeader model =
98+
header []
99+
[ h1 [] [ text "URL Interceptor" ]
100+
, p []
101+
[ text "The current URL is: "
102+
, b [] [ text (Url.toString model.url) ]
103+
]
104+
]
105+
106+
107+
mainContents : Html Msg
108+
mainContents =
109+
main_ []
110+
[ ul []
87111
[ viewLink "/home"
88112
, viewLink "/profile"
89113
, viewLink "/reviews/the-century-of-the-self"
@@ -92,7 +116,6 @@ view model =
92116
, viewLink "https://example.com/"
93117
]
94118
]
95-
}
96119

97120

98121
viewLink : String -> Html Msg

0 commit comments

Comments
 (0)