prikhi / bootstrap-gallery / BootstrapGallery

This module is used to render images as gallery thumbnails & lightboxes.

Configuration


type alias Config a =
{ thumbnailUrl : a -> Maybe String
, imageUrl : a -> String 
}

Configuration for pulling the thumbnail & image URLs out of an arbitrary image type.

Data


type alias Model a =
{ data : Maybe (SubModel a)
, style : Animation.State
, foregroundImageStyle : Animation.State
, backgroundImageStyle : Animation.State 
}

The internal state of the Gallery.

initial : Model a

A blank gallery with no associated images.

Rendering

modal : Model a -> Html (Msg a)

Render the Modal.

To get nice open/close transitions, you should always render the modal, even if the Modal has not been opened.

Preferably place this at the end of your HTML to prevent other elements from obscuring the modal while it transitions to the open state.

thumbnails : Config a -> List a -> Html (Msg a)

Render thumbnails in a column grid using the given list of images.

openOnClick : (Msg a -> msg) -> a -> Html.Attribute msg

Open the modal when the element is clicked & select the given item.

Updating


type Msg a

Messages the modal may raise.

update : Config a -> Msg a -> Model a -> List a -> Model a

Update the Gallery model.

subscriptions : Model a -> Platform.Sub.Sub (Msg a)

Subscribe to the animation updates.

open : Config a -> Model a -> List a -> a -> Model a

Open the modal & select the given item.

close : Config a -> Model a -> List a -> Model a

Close the modal.

next : Config a -> Model a -> List a -> Model a

Select the next item in the list.

previous : Config a -> Model a -> List a -> Model a

Select the previous item in the list.