1
0
Fork 0
forked from OpenNeo/impress

Add cart icon to Item Getting Guide's "Buy" buttons for NC Mall

This commit is contained in:
Emi Matchu 2024-05-21 18:12:40 -07:00
parent 4a74e5e1a7
commit 8440a28898
3 changed files with 11 additions and 1 deletions

View file

@ -101,7 +101,7 @@ a.button, input[type=submit], button
&.loud
+loud-awesome-button
.icon
margin-right: .375em
margin-right: .25em
vertical-align: middle
ul.buttons

View file

@ -25,6 +25,7 @@ module ApplicationHelper
klass = options.fetch(:class, "") + " button"
link_to url, class: klass, **options do
concat icon
concat " "
concat content
end
end
@ -77,6 +78,13 @@ module ApplicationHelper
end
end
# SVG icon source from Font Awesome 6! (https://creativecommons.org/licenses/by/4.0/)
CART_ICON_SVG_SOURCE = '<path fill="currentColor" d="M0 24C0 10.7 10.7 0 24 0H69.5c22 0 41.5 12.8 50.6 32h411c26.3 0 45.5 25 38.6 50.4l-41 152.3c-8.5 31.4-37 53.3-69.5 53.3H170.7l5.4 28.5c2.2 11.3 12.1 19.5 23.6 19.5H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H199.7c-34.6 0-64.3-24.6-70.7-58.5L77.4 54.5c-.7-3.8-4-6.5-7.9-6.5H24C10.7 48 0 37.3 0 24zM128 464a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zm336-48a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"></path>'.html_safe
def cart_icon(alt: "Cart")
content_tag :svg, CART_ICON_SVG_SOURCE, alt:, class: "icon",
viewBox: "0 0 576 512", style: "height: 1em"
end
def contact_email
"matchu@openneo.net"
end

View file

@ -20,6 +20,7 @@
%td.actions-cell
%button{onclick: "alert('Todo!')"}
= cart_icon alt: ""
Buy all in NC Mall
%tbody
- @nc_mall_items.each do |item|
@ -28,6 +29,7 @@
%td= item.name
%td.actions-cell
%button{onclick: "alert('Todo!')"}
= cart_icon alt: ""
Buy (#{item.current_nc_price} NC)
- if @np_items.present?