Sha256: a4b81158a665b94e3ed6f74cc72bbe7d402f6f9b8e18ce43d339dcf14f9ec01a
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module Components::ButtonHelper def render_button(label = "", text: nil, variant: :default, as: :button, href: nil, data: {}, **options, &block) button_classes = " inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10 px-4 py-2 " varianet_classes = case variant.to_sym when :default " bg-primary text-primary-foreground hover:bg-primary/90 " when :secondary " bg-secondary text-secondary-foreground hover:bg-secondary/80 " when :error, :danger, :alert, :destructive " bg-destructive text-destructive-foreground hover:bg-destructive/90 " when :outline " border border-input bg-background hover:bg-accent hover:text-accent-foreground" when :ghost " hover:bg-accent hover:text-accent-foreground " end button_classes << " #{varianet_classes} #{options[:class]}" button_classes = tw(button_classes) text = label if label.present? text = capture(&block) if block render "components/ui/button", text:, button_classes:, as:, href:, data:, **options end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shadcn-ui-0.0.12 | app/helpers/components/button_helper.rb |