demarches-normaliennes/app/components/dsfr/sidemenu_component.rb

19 lines
369 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
class Dsfr::SidemenuComponent < ApplicationComponent
renders_many :links, "LinkComponent"
class LinkComponent < ApplicationComponent
2023-04-24 15:13:51 +02:00
attr_reader :name, :url, :icon
def initialize(name:, url:, icon: nil)
@name = name
@url = url
2023-04-24 15:13:51 +02:00
@icon = icon
end
end
def active?(url)
current_page?(url)
end
end