module Config.Format exposing (..)

import Config.Colour exposing (..)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
import Html.Attributes as H exposing (style)


topLevelContainer : Element msg -> Element msg
topLevelContainer =
    el
        [ width fill
        , height fill
        , B.color colourTheme.backgroundColour
        ]


pageList : List (Attribute msg)
pageList =
    [ spacing 40
    , centerX
    , centerY
    , alignTop
    , paddingEach { top = 30, bottom = 30, left = 0, right = 0 }
    ]


transitionStyle : Attribute msg
transitionStyle =
    htmlAttribute <| style "transition" "all .1s"


transitionHighlightedLinkHover : Element msg -> Element msg
transitionHighlightedLinkHover =
    el
        [ mouseOver [ F.color colourTheme.highlightTextHover ]
        , transitionStyle
        ]


transitionNonHighlightedLinkHover : Element msg -> Element msg
transitionNonHighlightedLinkHover =
    el
        [ mouseOver [ F.color colourTheme.highlightText ]
        , transitionStyle
        ]


transitionNonHighlightedLinkHoverWithMove : Element msg -> Element msg
transitionNonHighlightedLinkHoverWithMove content =
    el
        [ width fill
        , height (px 30)
        ]
        (el
            [ centerX
            , centerY
            , mouseOver [ F.color colourTheme.highlightText, F.size 25 ]
            , transitionStyle
            ]
            content
        )


spartanFont : F.Font
spartanFont =
    F.typeface "League Spartan"


imageSpacer : Attribute msg
imageSpacer =
    spacing 20


navBarLinkFormat : List (Attr () msg)
navBarLinkFormat =
    [ F.size 15
    , centerX

    -- , F.bold
    ]


titleFormat : List (Attr () msg)
titleFormat =
    [ F.size 23
    , F.bold
    ]


nonHighlightedTitleFormat : List (Attr () msg)
nonHighlightedTitleFormat =
    [ F.color colourTheme.nonHighlightedText
    ]
        ++ titleFormat


highlightedTitleFormat : List (Attr () msg)
highlightedTitleFormat =
    [ F.color colourTheme.highlightText
    ]
        ++ titleFormat


paragraphFontSize : Attr decorative msg
paragraphFontSize =
    F.size 17


paragraphLinkFormat : { url : String, label : Element msg } -> Element msg
paragraphLinkFormat =
    newTabLink
        [ paragraphFontSize
        , F.color colourTheme.highlightText
        ]


paragraphSpacing : Attribute msg
paragraphSpacing =
    spacing 8


paragraphText : List (Attr () msg)
paragraphText =
    [ F.color colourTheme.nonHighlightedText
    , paragraphSpacing
    , paragraphFontSize
    ]


paragraphHightlightedBoldText : List (Attr () msg)
paragraphHightlightedBoldText =
    [ F.color colourTheme.highlightText
    , F.bold
    , paragraphSpacing
    , paragraphFontSize
    ]


paragraphFormat : List (Attr () msg)
paragraphFormat =
    []
        ++ paragraphText


paragraphBoldFormat : List (Attr () msg)
paragraphBoldFormat =
    [ F.bold ]
        ++ paragraphText


paragraphWidth : Attribute msg
paragraphWidth =
    width <| px 700


paragraphAlignLeft : List (Attr () msg)
paragraphAlignLeft =
    [ alignLeft, paragraphWidth ]
        ++ paragraphText


paragraphAlignCenter : List (Attr () msg)
paragraphAlignCenter =
    [ centerX, paragraphWidth ]
        ++ paragraphText


paragraphColumnFormat : List (Attribute msg)
paragraphColumnFormat =
    [ spacing 20
    , paragraphWidth
    ]
