all repos

onasty @ d0434ef

a one-time notes service

onasty/web/src/Components/Utils.elm(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Components.Utils exposing (commonContainer, viewIf, viewMaybe)

import Html as H exposing (Html)
import Html.Attributes as A


viewIf : Bool -> Html msg -> Html msg
viewIf condition html =
    if condition then
        html

    else
        H.text ""


viewMaybe : Maybe a -> (a -> Html msg) -> Html msg
viewMaybe maybeValue toHtml =
    case maybeValue of
        Just value ->
            toHtml value

        Nothing ->
            H.text ""


commonContainer : List (Html msg) -> Html msg
commonContainer child =
    H.div [ A.class "py-8 w-full max-w-4xl mx-auto " ]
        [ H.div [ A.class "rounded-lg border border-gray-200 shadow-sm" ] child ]