Skip to content

Commit f986269

Browse files
committed
style: run elm-format
1 parent 83c04c4 commit f986269

8 files changed

Lines changed: 42 additions & 38 deletions

File tree

src/Api.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module Api exposing (..)
33
import Effect exposing (Effect)
44
import Http
55
import Json.Decode as Json
6-
import LearningResources.Types as LearningResources
76
import LearningResources.Json as LearningResources
7+
import LearningResources.Types as LearningResources
88
import Yaml.Decode
99

1010

src/Effect.elm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ toCmd options effect =
213213
Task.succeed sharedMsg
214214
|> Task.perform options.fromSharedMsg
215215

216+
216217
sendSharedMsg : Shared.Msg.Msg -> Effect msg
217218
sendSharedMsg sharedMsg =
218-
SendSharedMsg sharedMsg
219+
SendSharedMsg sharedMsg

src/LearningResources.elm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ module LearningResources exposing (..)
22

33
import LearningResources.Types exposing (..)
44

5+
56
getResourcesByTag : EntityTag -> Database -> List Resource
67
getResourcesByTag tag database =
78
List.filter (\resource -> List.member tag resource.teaches) database.resources
89

10+
911
getMetadata : EntityTag -> Database -> Maybe CompiledMeta
1012
getMetadata tag database =
11-
List.head <| List.filter (\meta -> meta.id == tag) database.metadata
13+
List.head <| List.filter (\meta -> meta.id == tag) database.metadata

src/Pages/Learning/Resource_.elm

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module Pages.Learning.Resource_ exposing (Model, Msg, page)
22

3+
import Css
34
import Effect exposing (Effect)
45
import Html.Styled as Html exposing (Html, div, span, text)
56
import Html.Styled.Attributes as Attr exposing (css, href, target)
67
import Layouts
8+
import LearningResources.Emojis as Emojis
79
import LearningResources.Types as LearningResources
810
import Page exposing (Page)
911
import Route exposing (Route)
@@ -14,9 +16,7 @@ import Tailwind.Breakpoints as Breakpoints
1416
import Tailwind.Theme as Tw
1517
import Tailwind.Utilities as Tw
1618
import Theming
17-
import Css
1819
import View exposing (View)
19-
import LearningResources.Emojis as Emojis
2020

2121

2222
page : Shared.Model -> Route { resource : String } -> Page Model Msg
@@ -27,9 +27,12 @@ page shared route =
2727
, subscriptions = \_ -> Sub.none
2828
, view = view shared route.params
2929
}
30-
|> Page.withLayout (\_ -> Layouts.Global {
31-
activePage = Route.Path.Learning
32-
})
30+
|> Page.withLayout
31+
(\_ ->
32+
Layouts.Global
33+
{ activePage = Route.Path.Learning
34+
}
35+
)
3336

3437

3538
type alias Model =
@@ -59,7 +62,7 @@ view shared route _ =
5962
LearningResources.entityTagFromString route.resource
6063

6164
activeMeta =
62-
activeTag
65+
activeTag
6366
|> Maybe.andThen (\tag -> List.filter (\m -> m.id == tag) db.metadata |> List.head)
6467
in
6568
{ title = Maybe.map .name activeMeta |> Maybe.withDefault "Topic"
@@ -71,14 +74,11 @@ view shared route _ =
7174
viewExplorerLayout : LearningResources.Database -> Maybe LearningResources.EntityTag -> String -> Html Msg
7275
viewExplorerLayout db activeTag activeSlug =
7376
div [ css [ Tw.flex, Tw.max_w_7xl, Tw.mx_auto, Tw.pt_12, Tw.pb_24, Tw.gap_12 ] ]
74-
[
75-
div [ css [ Tw.w_64, Tw.flex_shrink_0, Tw.hidden, Breakpoints.lg [ Tw.block ] ] ]
76-
[ Html.h3 [ css [ Theming.headingFont, Tw.text_xl, Tw.mb_6, Tw.border_b, Tw.border_color Tw.slate_700, Tw.pb_2 ] ]
77+
[ div [ css [ Tw.w_64, Tw.flex_shrink_0, Tw.hidden, Breakpoints.lg [ Tw.block ] ] ]
78+
[ Html.h3 [ css [ Theming.headingFont, Tw.text_xl, Tw.mb_6, Tw.border_b, Tw.border_color Tw.slate_700, Tw.pb_2 ] ]
7779
[ text "Topics" ]
7880
, viewSidebarTopicList db.metadata activeSlug
7981
]
80-
81-
8282
, div [ css [ Tw.flex_1 ] ]
8383
[ case activeTag of
8484
Nothing ->
@@ -124,8 +124,16 @@ viewSidebarLink activeSlug meta =
124124
, Tw.px_3
125125
, Tw.rounded_lg
126126
, Tw.transition_colors
127-
, if isActive then Tw.bg_color Tw.slate_800 else Tw.bg_color Tw.transparent
128-
, if isActive then Tw.text_color Tw.white else Tw.text_color Tw.gray_400
127+
, if isActive then
128+
Tw.bg_color Tw.slate_800
129+
130+
else
131+
Tw.bg_color Tw.transparent
132+
, if isActive then
133+
Tw.text_color Tw.white
134+
135+
else
136+
Tw.text_color Tw.gray_400
129137
, Css.hover [ Tw.text_color Tw.white, Tw.bg_color Tw.slate_800 ]
130138
]
131139
]
@@ -144,7 +152,7 @@ viewTopicHeader maybeMeta =
144152
[ div [ css [ Tw.text_5xl ] ] [ text (Emojis.emojiOrBackup meta) ]
145153
, Html.h1 [ css [ Theming.headingFont, Tw.text_4xl, Tw.font_bold ] ] [ text meta.name ]
146154
]
147-
, Html.p [ css [ Theming.bodyFont, Tw.text_xl, Tw.text_color Tw.gray_300, Tw.mb_4 ] ]
155+
, Html.p [ css [ Theming.bodyFont, Tw.text_xl, Tw.text_color Tw.gray_300, Tw.mb_4 ] ]
148156
[ text meta.description ]
149157
]
150158

@@ -153,6 +161,7 @@ viewResourceGrid : List LearningResources.Resource -> Html Msg
153161
viewResourceGrid resources =
154162
if List.isEmpty resources then
155163
div [ css [ Theming.bodyFont, Tw.text_color Tw.gray_400, Tw.italic ] ] [ text "No resources found for this topic yet." ]
164+
156165
else
157166
div [ css [ Tw.grid, Tw.grid_cols_1, Breakpoints.md [ Tw.grid_cols_2 ], Tw.gap_6 ] ]
158167
(List.map viewResourceCard resources)
@@ -161,30 +170,23 @@ viewResourceGrid resources =
161170
viewResourceCard : LearningResources.Resource -> Html Msg
162171
viewResourceCard resource =
163172
Theming.cardShell [ Tw.p_6, Tw.flex, Tw.flex_col ]
164-
[
165-
div [ css [ Tw.flex, Tw.justify_between, Tw.items_start, Tw.mb_4 ] ]
173+
[ div [ css [ Tw.flex, Tw.justify_between, Tw.items_start, Tw.mb_4 ] ]
166174
[ Html.h3 [ css [ Theming.headingFont, Tw.text_lg ] ] [ text resource.name ]
167175
, viewPricingBadge resource.pricing
168176
]
169-
170-
171177
, div [ css [ Tw.flex, Tw.gap_2, Tw.mb_4 ] ]
172178
(List.map viewTypeBadge resource.type_)
173-
174-
175179
, Html.p [ css [ Theming.bodyFont, Tw.text_sm, Tw.mb_6, Tw.flex_grow ] ]
176180
[ text (Maybe.withDefault "No description provided." resource.description) ]
177-
178-
179-
, Html.a
181+
, Html.a
180182
[ Attr.href resource.url
181183
, Attr.target "_blank"
182-
, css
184+
, css
183185
[ Theming.headingFont
184186
, Tw.text_color Tw.dd_pink
185187
, Css.hover [ Tw.text_color Tw.white ]
186-
, Tw.transition_colors
187-
]
188+
, Tw.transition_colors
189+
]
188190
]
189191
[ text "Read more ->" ]
190192
]
@@ -235,4 +237,4 @@ viewPricingBadge pricing =
235237
, Tw.rounded_md
236238
]
237239
]
238-
[ text (paid.model ++ ": $" ++ String.fromFloat paid.amount) ]
240+
[ text (paid.model ++ ": $" ++ String.fromFloat paid.amount) ]

src/Pages/Rules.elm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ viewRuleSection section =
188188
[ h3
189189
[ css [ Theming.headingFont, Tw.text_2xl, Tw.text_color Tw.dd_teal, Tw.mb_3 ] ]
190190
[ text (String.fromInt section.id ++ ". " ++ section.title) ]
191-
, div [ css [ Tw.flex, Tw.flex_col, Tw.gap_2] ]
191+
, div [ css [ Tw.flex, Tw.flex_col, Tw.gap_2 ] ]
192192
(List.indexedMap viewRuleLine section.rules)
193193
]
194194

@@ -200,14 +200,14 @@ viewRuleLine index content =
200200
letter =
201201
String.fromChar (Char.fromCode (97 + index)) ++ ". "
202202
in
203-
p
204-
[ css
203+
p
204+
[ css
205205
[ Theming.bodyFont
206206
, Tw.text_base
207207
, Tw.text_color Tw.gray_300
208208
, Tw.leading_snug
209-
, Tw.m_0
210-
]
209+
, Tw.m_0
210+
]
211211
]
212212
(Html.text letter :: content)
213213

src/Shared.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ module Shared exposing
1313
-}
1414

1515
import Api
16+
import Dict
1617
import Effect exposing (Effect)
1718
import Json.Decode
1819
import Route exposing (Route)
1920
import Shared.Model
2021
import Shared.Msg
21-
import Dict
2222

2323

2424

src/Shared/Model.elm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type LearningDatabaseStatus
2323
| Failure Http.Error
2424

2525

26-
2726
type alias Model =
2827
{ learningDatabase : LearningDatabaseStatus
2928
}

src/Theming.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Tailwind.Utilities as Tw
1010
brandGradientBg : Css.Style
1111
brandGradientBg =
1212
-- elm tailwind doesnt seem to play well with this
13-
Css.property "background-image"
13+
Css.property "background-image"
1414
"linear-gradient(to right, var(--color-den-teal), var(--color-den-indigo), var(--color-den-pink))"
1515

1616

0 commit comments

Comments
 (0)