Skip to content

Instantly share code, notes, and snippets.

@mdgriffith
Created November 7, 2021 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdgriffith/80ddf9eb5917a70b34d3c35f3a042fa9 to your computer and use it in GitHub Desktop.
Save mdgriffith/80ddf9eb5917a70b34d3c35f3a042fa9 to your computer and use it in GitHub Desktop.
-- in Ui.elm
image :
List (Attribute msg)
->
{ source : String
, description : String
}
-> Element msg
-- in Ui.Image
module Ui.Image exposing (source, responsive, dynamic)
-- images where you have size information
-- and can suggest to the browser which to use
responsive :
List (Attribute msg)
->
{ sources :
List Source
, description : String
}
-> Element msg
source :
{ src : String
, width : Int
, pixelDenstiy : Float
}
-> Source
-- for images that you dont already have info on
dynamic :
List (Attribute msg)
->
{ source : String
, onLoad :
Maybe
({ width : Int
, height : Int
}
-> msg
)
, onError : Maybe msg
, fallback :
Maybe
{ source : String
}
, description : String
}
-> Element msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment