Sha256: fd97cd42c0155a0832cf457683f1c51fb88b9363a128ebbeb486744c5acb83e8

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

module Yattho
  module Alpha
    class Dialog
      # A `Dialog::Header` is a compositional component, used to render the
      # Header of a dialog. See <%= link_to_component(Yattho::Alpha::Dialog) %>.
      class Header < Yattho::Component
        status :alpha
        audited_at "2022-10-10"

        # @param title [String] Describes the content of the dialog.
        # @param subtitle [String] Provides dditional context for the dialog, also setting the `aria-describedby` attribute.
        # @param show_divider [Boolean] Show a divider between the header and body.
        # @param visually_hide_title [Boolean] Visually hide the `title` while maintaining a label for assistive technologies.
        # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
        def initialize(
          id:,
          title:,
          subtitle: nil,
          show_divider: false,
          visually_hide_title: false,
          **system_arguments
        )
          @id = id
          @title = title
          @subtitle = subtitle
          @visually_hide_title = visually_hide_title
          @system_arguments = deny_tag_argument(**system_arguments)
          @system_arguments[:tag] = :div
          @system_arguments[:classes] = class_names(
            "Overlay-header",
            { 'Overlay-header--divided': show_divider },
            system_arguments[:classes]
          )
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 app/components/yattho/alpha/dialog/header.rb
yattho_view_components-0.0.1 app/components/yattho/alpha/dialog/header.rb