VoileWeb.VoileComponents (Voile v0.1.23)

Copy Markdown View Source

Centralized UI components for the Voile frontend

Summary

Functions

Builds a search URL with GLAM type and query parameters

Collection card component for displaying collection information.

Compact search suggestions component for better performance

Empty state component for when no results are found.

Custom pagination component for frontend views (renamed from the original pagination).

Collection card with GLAM type support

GLAM type badge component

Returns a human-readable description for each GLAM type

GLAM type filter component for search results

Returns the appropriate icon for a GLAM type

Highlights search query within text

Item card component for displaying item information.

Item row component for list view display.

Main Search Component for GLAM (Gallery, Library, Archive, Museum)

Related item card component for showing related items.

Search suggestions dropdown component

Statistics item component for displaying stats with icons.

Functions

access_level_badge_class(_)

availability_badge(_)

availability_badge_class(_)

build_page_url(page, search_query, filter_unit_id, filter_status, type_page, filter_glam_type \\ nil)

build_search_url(glam_type \\ "quick", query \\ "", additional_params \\ %{})

Builds a search URL with GLAM type and query parameters

collection_card(assigns)

Collection card component for displaying collection information.

Attributes

  • collection (:map) (required)

compact_search_suggestions(assigns)

Compact search suggestions component for better performance

Attributes

  • results (:list) (required)
  • search_query (:string) - Defaults to "".
  • current_glam_type (:string) - Defaults to "quick".
  • selected_index (:integer) - Defaults to -1.
  • max_results (:integer) - Defaults to 6.

condition_badge(_)

condition_badge_class(_)

empty_state(assigns)

Empty state component for when no results are found.

Attributes

  • search_query (:string) - Defaults to "".
  • icon_name (:string) - Defaults to "hero-book-open".
  • title (:string) - Defaults to "No results found".
  • message (:string) - Defaults to "".

frontend_pagination(assigns)

Custom pagination component for frontend views (renamed from the original pagination).

Attributes

  • current_page (:integer) (required)
  • total_pages (:integer) (required)
  • search_query (:string) - Defaults to "".
  • filter_unit_id (:string) - Defaults to "all".
  • filter_status (:string) - Defaults to "published".
  • type_page (:string) - Defaults to "collections".
  • filter_glam_type (:string) - Defaults to "all".
  • socket (:map) - Defaults to nil.

frontend_pagination_pages(current_page, total_pages)

glam_collection_card(assigns)

Collection card with GLAM type support

Attributes

  • collection (:map) (required)
  • show_glam_type (:boolean) - Defaults to true.

glam_type_badge(assigns)

GLAM type badge component

Attributes

  • glam_type (:string) (required)
  • size (:string) - Defaults to "sm".

glam_type_badge_class(_)

glam_type_description(_)

Returns a human-readable description for each GLAM type

glam_type_filter(assigns)

GLAM type filter component for search results

Attributes

  • current_glam_type (:string) - Defaults to "quick".
  • search_query (:string) - Defaults to "".
  • counts (:map) - Defaults to %{}.

glam_type_icon(_)

Returns the appropriate icon for a GLAM type

highlight_text(assigns)

Highlights search query within text

Attributes

  • text (:string) (required)
  • query (:string) - Defaults to "".

item_card(assigns)

Item card component for displaying item information.

Attributes

  • item (:map) (required)

item_row(assigns)

Item row component for list view display.

Attributes

  • item (:map) (required)

main_search(assigns)

Main Search Component for GLAM (Gallery, Library, Archive, Museum)

Examples

<.main_search current_glam_type="quick" search_query="" />

The component accepts current_glam_type and search_query for state management.

Attributes

  • current_glam_type (:string) - Defaults to "quick".
  • search_query (:string) - Defaults to "".
  • form_action (:string) - Defaults to "/search".
  • live_action (:atom) - Defaults to nil.
  • search_results (:list) - Defaults to [].
  • show_suggestions (:boolean) - Defaults to false.
  • loading (:boolean) - Defaults to false.

search_suggestions(assigns)

Search suggestions dropdown component

Attributes

  • results (:list) (required)
  • search_query (:string) - Defaults to "".
  • current_glam_type (:string) - Defaults to "quick".
  • max_results (:integer) - Defaults to 8.

stat_item(assigns)

Statistics item component for displaying stats with icons.

Attributes

  • icon (:string) (required)
  • value (:string) (required)
  • label (:string) (required)

status_badge_class(_)