Sha256: fc634834a7aab15a3fd12a6f5b3f688914226497af7fb0f96ebfde0c3f199be8
Contents?: true
Size: 822 Bytes
Versions: 25
Compression:
Stored size: 822 Bytes
Contents
module Coco module App module Elements class SystemBanner < Coco::Component include Concerns::AcceptsOptions include Concerns::WrapsComponent wraps_component :alert do |args| theme = vivid_theme_name(args.fetch(:theme, nil)) || :info_vivid Coco::App::Elements::Alert.new(**args, theme: theme, banner: true, single_line: true) end %i[title action secondary_action link].each do |slot_name| renders_one slot_name, ->(**kwargs, &block) do alert.send("with_#{slot_name}".to_sym, **kwargs, &block) end end private def vivid_theme_name(theme) if theme.present? "#{theme.to_s.underscore.gsub("_vivid", "")}_vivid".to_sym end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems