Method: Primer::Beta::Spinner#initialize
- Defined in:
- app/components/primer/beta/spinner.rb
#initialize(size: DEFAULT_SIZE, style: DEFAULT_STYLE, sr_text: DEFAULT_SR_TEXT, **system_arguments) ⇒ Spinner
Returns a new instance of Spinner.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/components/primer/beta/spinner.rb', line 26 def initialize(size: DEFAULT_SIZE, style: DEFAULT_STYLE, sr_text: DEFAULT_SR_TEXT, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :svg @system_arguments[:style] ||= style @system_arguments[:animation] = :rotate @system_arguments[:width] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)] @system_arguments[:height] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)] @system_arguments[:viewBox] = "0 0 16 16" @system_arguments[:fill] = :none @system_arguments[:aria] ||= {} @sr_text = sr_text if no_aria_label? @system_arguments[:aria][:hidden] = true else @system_arguments[:role] = "img" end @target = extract_data(:target, @system_arguments) @hidden = @system_arguments.delete(:hidden) end |