Skip to content

Commit

Permalink
refactor: ♻️ Cleaned up how default classes are added to the button
Browse files Browse the repository at this point in the history
  • Loading branch information
joshsadam committed Oct 23, 2024
1 parent 6f178c1 commit 60b63ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion embedded_gems/flowbite/app/components/flowbite/button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class Button < Flowbite::Component
include Flowbite::ButtonVisuals
include Flowbite::ButtonSizes

DEFAULT_CLASSES = 'rounded-lg font-medium focus:outline-none focus:ring-4 ' \
'disabled:opacity-50 disabled:cursor-not-allowed'

# rubocop:disable Metrics/ParameterLists
def initialize(base_button_class: Flowbite::BaseButton, scheme: DEFAULT_SCHEME, size: DEFAULT_SIZE, block: false,
disabled: false, label_wrap: false, **system_arguments)
Expand All @@ -29,7 +32,7 @@ def initialize(base_button_class: Flowbite::BaseButton, scheme: DEFAULT_SCHEME,
system_arguments[:classes],
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)],
'rounded-lg font-medium focus:outline-none focus:ring-4 disabled:opacity-50 disabled:cursor-not-allowed',
DEFAULT_CLASSES,
'block w-full' => block
)
end
Expand Down

0 comments on commit 60b63ca

Please sign in to comment.