module Config.Style.Images exposing
    ( ElementSize(..)
    , imageSizer
    , imageSquareMaker
    , roundingScaler
    )

import Config.Data.ImageFolders
    exposing
        ( ImageFolder(..)
        , imagePathMaker
        )
import Config.Style.Colour.Helpers
    exposing
        ( ThemeColor(..)
        , colourTheme
        , getThemeColor
        )
import Element as E
    exposing
        ( Device
        , Element
        , Length
        , clip
        , fill
        , height
        , image
        , px
        , rgb255
        , width
        )
import Element.Background as B exposing (color)
import Element.Border as D
    exposing
        ( color
        , rounded
        , width
        )


imageSquareMaker : Device -> String -> Bool -> ElementSize -> Element msg
imageSquareMaker device imagePath isLeft size =
    E.image
        [ D.rounded (roundingScaler size)
        , clip
        , E.width <| imageSizer size
        , E.height <| imageSizer size
        , if imagePath == imagePathMaker Donate "cardano" then
            B.color (rgb255 4 20 108)

          else
            B.color (getThemeColor BackgroundLightGrey)
        ]
        { src = imagePath
        , description = ""
        }


imageSizer : ElementSize -> Length
imageSizer size =
    case size of
        Fill ->
            fill

        Big ->
            px 128

        Medium ->
            px 65

        Small ->
            px 20


roundingScaler : ElementSize -> Int
roundingScaler size =
    case size of
        Fill ->
            32

        Big ->
            32

        Medium ->
            10

        Small ->
            10


type ElementSize
    = Fill
    | Big
    | Medium
    | Small
