TodoCard Component Blueprint

InfoGenerateCreated ByPackages

This Ruby class defines a todo card component for a web application. It extends 'ApplicationComponent' and generates HTML markup within its 'template' method. The generated HTML represents a card with specific styling ('card w-96 bg-primary text-primary-content'). Inside the card, there's a body ('card-body') containing a title section and action buttons. The title section ('card-title') includes a 'Todo Item Name' and a trash icon (using Font Awesome). The action section ('card-actions') includes a button labeled 'Mark Complete'. Overall, the component provides a styled user interface for displaying and interacting with a todo item.

# frozen_string_literal: true

class TodoCardComponent < ApplicationComponent
  def template
    div(class: "card w-96 bg-primary text-primary-content") do
      div(class: "card-body") do
        h2(class: "card-title flex justify-between items-center") do
          span { "Todo Item Name" }
          i(class: "fas fa-trash-alt cursor-pointer") # Font Awesome trash icon
        end
        div(class: "card-actions justify-end") do
          button(class: "btn") { "Mark Complete" }
        end
      end
    end
  end
end