Module Listing

Listing component for displaying a list of items with optional filtering by tags, sorting, and different display styles. Inspired by Drupal's Views module.

type display =
  1. | Default
  2. | Card
type 'tag tags =
  1. | Including of 'tag list
  2. | Excluding of 'tag list
type 'item sort_by = {
  1. compare : 'item -> 'item -> int;
}
type ('item, 'tag) content_type = {
  1. items : 'item list;
  2. render : 'item -> display -> Html_types.flow5 Tyxml_html.elt;
  3. tags : 'item -> 'tag list;
  4. tag_equal : 'tag -> 'tag -> bool;
}
type ('item, 'tag) config = {
  1. heading : string option;
  2. content_type : ('item, 'tag) content_type;
  3. display : display;
  4. maximum_items : int;
  5. sort_by : 'item sort_by;
  6. tags : 'tag tags option;
}
type t =
  1. | Listing : ('item, 'tag) config -> t
val make : ?heading:string -> ?tags:'a tags -> content_type:('b, 'a) content_type -> display:display -> maximum_items:int -> sort_by:'b sort_by -> unit -> t
val take : int -> 'a list -> 'a list
val has_any_tag : eq:('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val filter_by_tags : extract_tags:('a -> 'b list) -> eq:('c -> 'b -> bool) -> tags:'c tags option -> 'a list -> 'a list
val display_class : display -> string
val render : t -> [> Html_types.div ] Tyxml.Html.elt