* Remove extraneous comment (see 9361d2 and 5c18f8) * Flexible, multiple reaction types * Fix reaction counts * Re-use svg for active state for now * Update yml, update spec * Possible temp fix for failing tests * Colorize reaction icon svgs * Reaction engagement above post title * Index reactions engagements (for logged-out) * Maybe readinglist is special * Try using crayons' dropdown as a drawer? * readinglist isn't really public now * feat: update the styles for the reaction drawer * Grey background highlight, turn off border/shadow * Read our feature flag docs, saw this was recommended * Missed fifth emoji: party/tada * Fix JS test errors * Update test with tada * Suppress flashing engagements when no public reactions * Liberate jump-to-comments from unicorn replacement * 'Add reaction' on tooltip * Don't show reaction emoji on index unless it's been used * rubocop * Update heart+ total count when toggling * Do not include 'readinglist' in drawer/public counts * Fix semi-public readinglist so that icon is badged for current user * Tweak heart-plus svg * Style tweak: border on active reaction * Show reacted icon on drawer trigger for 1.5 sec * Tweak styles for engagements bar * Style tweaks for multiple engagements (#index) * Trying to get size working through crayons/inline_svg * Sparkle hearts * Restore unicorn * Make heart-plus-active work when user has an active reaction * Try 'hoverdown' a dropdown that activates with hover * Long touch? * Tap *outside* the drawer to close * Mobile reaction drawer is also supposed to be columns * More reaction count cleanup * Final emoticons maybe? * Fix reaction bug when feature disabled * Remove readinglist from public reaction counts * Update specs for new reaction categories * Shuffle makes specs flaky * Order does not matter * rubocop * Update to preserve readinglist analytics * Shuffle makes specs flaky * Fix flickering images, remove icon highlight for now * Don't update total for readinglist * reactions_by_user_id * Try renaming this observer function * Try unid ids for SVGs * Remove local test file * Simplistic test for the unique svg transform * Fix javascript for current SVG * Signifcant string literals in this case, rubocop * Use the right expected output Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
37 lines
1.3 KiB
Ruby
37 lines
1.3 KiB
Ruby
module CrayonsHelper
|
|
# A wrapper for the +inline_svg_tag+ helper specifically for Crayons icons.
|
|
#
|
|
# @param name [String|Symbol] the icon name. The ".svg" file extension will
|
|
# be added automatically if missing.
|
|
# @param native [Boolean] when set to +true+ the icon will not inherit its
|
|
# parent's color.
|
|
# @param opts [Hash] additional keyword arguments (like e.g. +class+) to be passed
|
|
# through to the +inline_svg_tag+ helper.
|
|
# @return [String] the SVG tag.
|
|
#
|
|
# @example Simplest form
|
|
# crayons_icon_tag(:twitter)
|
|
#
|
|
# @example Disabling color inheritance
|
|
# crayons_icon_tag("twemoji/heart", native: true)
|
|
#
|
|
# @example Specifying additional CSS classes
|
|
# crayons_icon_tag("twitter.svg", class: "pointer-events-none")
|
|
#
|
|
# @example Specifying additional kwards to be passed to +inline_svg_tag+
|
|
# crayons_icon_tag(:home, title: "Home")
|
|
def crayons_icon_tag(name, native: false, **opts)
|
|
name = name.to_s
|
|
icon_name = name.ends_with?(".svg") ? name : "#{name}.svg"
|
|
icon_class = [
|
|
"crayons-icon",
|
|
("crayons-icon--default" if native),
|
|
opts.delete(:class),
|
|
].compact.join(" ")
|
|
|
|
opts[:width] ||= 24
|
|
opts[:height] ||= 24
|
|
|
|
inline_svg_tag(icon_name, aria: true, class: icon_class, **opts)
|
|
end
|
|
end
|