module ViewComponent::ContentAreas

def with_content_areas(*areas)

def with_content_areas(*areas)
  ViewComponent::Deprecation.warn(
    "`with_content_areas` is deprecated and will be removed in ViewComponent v3.0.0.\n\n" \
    "Use slots (https://viewcomponent.org/guide/slots.html) instead."
  )
  if areas.include?(:content)
    raise ArgumentError.new(
      "#{self} defines a content area called :content, which is a reserved name. \n\n" \
      "To fix this issue, use another name, such as `:body`."
    )
  end
  areas.each do |area|
    define_method area.to_sym do
      content unless content_evaluated? # ensure content is loaded so content_areas will be defined
      instance_variable_get(:"@#{area}") if instance_variable_defined?(:"@#{area}")
    end
  end
  self.content_areas = areas
end