Class: Www::SaleBadgeComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Www::SaleBadgeComponent
- Defined in:
- app/components/www/sale_badge_component.rb
Overview
ViewComponent: renders the sale badge block.
Displays a Bootstrap badge with the discount percentage, sized
according to the size option (:small, :normal, or :large).
Instance Method Summary collapse
-
#initialize(percentage:, size: :normal) ⇒ Www::SaleBadgeComponent
constructor
A new instance of the component.
Methods inherited from ApplicationComponent
#cms_link, #fetch_or_fallback, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags
Constructor Details
#initialize(percentage:, size: :normal) ⇒ Www::SaleBadgeComponent
Returns a new instance of the component.
11 12 13 14 |
# File 'app/components/www/sale_badge_component.rb', line 11 def initialize(percentage:, size: :normal) @percentage = percentage @size = size end |