Skip to content

Commit

Permalink
add selected argument to LanguageSelector component
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Sep 5, 2023
1 parent 7478c14 commit 45f4b58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/components/input/language_selector_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

class Input::LanguageSelectorComponent < ViewComponent::Base

def initialize(languages:, id: '', name: '' )
def initialize(languages:, selected: nil, id: '', name: '' )
super
@languages = languages
@id = id
@name = languages
@selected = selected
end

def languages_options
Expand All @@ -20,6 +21,6 @@ def languages_options
end

def call
render SelectInputComponent.new(id: @id, name: @name, values: languages_options, placeholder: 'Select a language')
render SelectInputComponent.new(id: @id, name: @name, values: languages_options, selected: @selected, placeholder: 'Select a language')
end
end

0 comments on commit 45f4b58

Please sign in to comment.