CardWithBottomImageComponent
The code describes a Ruby class named `CardWithBottomImageComponent` which inherits from `ApplicationComponent`. Its main functionality is to generate HTML content structured in a `div` with a class of `card w-96 bg-base-100 shadow-xl`. Inside this `div`, there is another `div` with a class of `card-body`, containing a header (`h2`) with the text "Shoes!" and a paragraph (`p`) containing the text "If a dog chews shoes whose shoes does he choose?" Below the `card-body` `div`, there is a `figure` tag containing an `img` element with a source URL pointing to an image of shoes and an alternate text of "Shoes". The purpose of this class is to create a styled card component with a title, description text, and an image at the bottom, likely used for representing items or products in a user interface.
# frozen_string_literal: true
class CardWithBottomImageComponent < ApplicationComponent
def template
div class: "card w-96 bg-base-100 shadow-xl" do
div class: "card-body" do
h2(class: "card-title"){ "Shoes!" }
p { "If a dog chews shoes whose shoes does he choose?" }
end
figure do
img(src: "https://daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.jpg", alt: "Shoes")
end
end
end
end