Module: Karafka::Web::Ui::Helpers::TailwindHelper
- Included in:
- Base
- Defined in:
- lib/karafka/web/ui/helpers/tailwind_helper.rb
Overview
Helper for generating tailwind rendering components with Ruby Simplifies many places in the UI
Constant Summary collapse
- TYPES =
style types of components we support
%i[ info error warning success primary secondary ].freeze
Instance Method Summary collapse
-
#badge(content, classes: '') ⇒ String
Renders a plain badge.
-
#link_button(name, path, classes: '', title: nil) ⇒ String
Renders a link to with button styling.
-
#tailwind_types ⇒ Array<Symbol>
Style types of components we support.
Instance Method Details
#badge(content, classes: '') ⇒ String
Renders a plain badge
29 30 31 |
# File 'lib/karafka/web/ui/helpers/tailwind_helper.rb', line 29 def badge(content, classes: '') %(<span class="badge #{classes}">#{content}</span>) end |
#link_button(name, path, classes: '', title: nil) ⇒ String
Renders a link to with button styling
39 40 41 |
# File 'lib/karafka/web/ui/helpers/tailwind_helper.rb', line 39 def (name, path, classes: '', title: nil) %(<a href="#{path}" class="btn #{classes}" title="#{title}">#{name}</a>) end |
#tailwind_types ⇒ Array<Symbol>
Returns style types of components we support.
21 22 23 |
# File 'lib/karafka/web/ui/helpers/tailwind_helper.rb', line 21 def tailwind_types TYPES end |