diff --git a/app/assets/stylesheets/buttons.css b/app/assets/stylesheets/buttons.css
index ee383e95b..2969db1dc 100644
--- a/app/assets/stylesheets/buttons.css
+++ b/app/assets/stylesheets/buttons.css
@@ -27,29 +27,12 @@
opacity var( --transition),
scale var( --transition);
- img {
- -webkit-touch-callout: none;
-
- pointer-events: none;
- user-select: none;
- }
-
/* Default icon styles */
- &:where(:has(img, svg)) {
+ &:where(:has(.icon)) {
text-align: start;
- img, svg {
- block-size: var(--btn-icon-size, 1.3em);
- inline-size: var(--btn-icon-size, 1.3em);
- max-inline-size: unset;
- }
-
- img:not([class]) {
- filter: invert(0);
-
- @media (prefers-color-scheme: dark) {
- filter: invert(1);
- }
+ .icon {
+ --icon-size: var(--btn-icon-size, 1.3em);
}
}
@@ -71,6 +54,7 @@
}
img {
+ --icon-size: 100%;
block-size: 100%;
inline-size: 100%;
max-inline-size: unset;
@@ -85,7 +69,7 @@
/* Circle buttons */
&.btn--circle,
- &:where(:has(.for-screen-reader):has(img, svg)) {
+ &:where(:has(.for-screen-reader):has(.icon)) {
--btn-border-radius: 50%;
--btn-padding: 0;
@@ -108,7 +92,7 @@
:is(input[type=radio]),
:is(input[type=checkbox]) {
--hover-size: 0;
-
+
appearance: none;
border-radius: var(--btn-border-radius);
cursor: pointer;
@@ -119,7 +103,7 @@
position: absolute;
}
- img.checked {
+ .checked {
display: none;
}
}
@@ -129,17 +113,7 @@
--btn-color: var(--color-ink-reversed);
--outline-color: var(--color-ink);
- img {
- filter: invert(1);
- }
-
- @media (prefers-color-scheme: dark) {
- img {
- filter: invert(0);
- }
- }
-
- img.checked {
+ .checked {
display: block;
}
}
@@ -203,14 +177,6 @@
:is(.btn--link, .btn--negative, .btn--positive, .btn--reversed) {
--btn-border-color: var(--color-bg);
-
- img:not([class]) {
- filter: invert(1);
-
- @media (prefers-color-scheme: dark) {
- filter: invert(0);
- }
- }
}
.btn--small {
@@ -220,7 +186,7 @@
.btn--success {
animation: success 1s ease-out;
- img {
+ .icon {
animation: zoom-fade 300ms ease-out;
}
}
diff --git a/app/assets/stylesheets/colors.css b/app/assets/stylesheets/colors.css
index 354c24011..79e852697 100644
--- a/app/assets/stylesheets/colors.css
+++ b/app/assets/stylesheets/colors.css
@@ -54,22 +54,6 @@
}
}
-.colorize--white {
- filter: invert(1);
-
- @media (prefers-color-scheme: dark) {
- filter: invert(0);
- }
-}
-
-.colorize--black {
- filter: invert(0);
-
- @media (prefers-color-scheme: dark) {
- filter: invert(1);
- }
-}
-
.color-picker {
--panel-border-color: var(--bubble-color);
--panel-border-radius: 2em;
diff --git a/app/assets/stylesheets/icons.css b/app/assets/stylesheets/icons.css
new file mode 100644
index 000000000..6fab09ef1
--- /dev/null
+++ b/app/assets/stylesheets/icons.css
@@ -0,0 +1,74 @@
+.icon {
+ -webkit-touch-callout: none;
+ background-color: currentColor;
+ block-size: var(--icon-size, 1em);
+ display: inline-block;
+ flex-shrink: 0;
+ inline-size: var(--icon-size, 1em);
+ mask-image: var(--svg);
+ mask-repeat: no-repeat;
+ mask-size: cover;
+ pointer-events: none;
+ user-select: none;
+}
+
+.icon--activity { --svg: url("activity.svg "); }
+.icon--add { --svg: url("add.svg "); }
+.icon--alert { --svg: url("alert.svg "); }
+.icon--arrow-left { --svg: url("arrow-left.svg "); }
+.icon--arrow-right { --svg: url("arrow-right.svg "); }
+.icon--art { --svg: url("art.svg "); }
+.icon--assigned { --svg: url("assigned.svg "); }
+.icon--bell-off { --svg: url("bell-off.svg "); }
+.icon--bell { --svg: url("bell.svg "); }
+.icon--blob { --svg: url("blob.svg "); }
+.icon--bolt { --svg: url("bolt.svg "); }
+.icon--bookmark-outline { --svg: url("bookmark-outline.svg "); }
+.icon--bookmark { --svg: url("bookmark.svg "); }
+.icon--bubble-add { --svg: url("bubble-add.svg "); }
+.icon--bubbles { --svg: url("bubbles.svg "); }
+.icon--calendar-add { --svg: url("calendar-add.svg "); }
+.icon--calendar { --svg: url("calendar.svg "); }
+.icon--camera { --svg: url("camera.svg "); }
+.icon--chart { --svg: url("chart.svg "); }
+.icon--check { --svg: url("check.svg "); }
+.icon--close { --svg: url("close.svg "); }
+.icon--comment { --svg: url("comment.svg "); }
+.icon--copy-paste { --svg: url("copy-paste.svg "); }
+.icon--crown { --svg: url("crown.svg "); }
+.icon--drag { --svg: url("drag.svg "); }
+.icon--email { --svg: url("email.svg "); }
+.icon--everyone { --svg: url("everyone.svg "); }
+.icon--filter { --svg: url("filter.svg "); }
+.icon--globe { --svg: url("globe.svg "); }
+.icon--grid { --svg: url("grid.svg "); }
+.icon--history { --svg: url("history.svg "); }
+.icon--home { --svg: url("home.svg "); }
+.icon--hourglass { --svg: url("hourglass.svg "); }
+.icon--inbox { --svg: url("inbox.svg "); }
+.icon--logout { --svg: url("logout.svg "); }
+.icon--menu-dots-horizontal { --svg: url("menu-dots-horizontal.svg "); }
+.icon--minus { --svg: url("minus.svg "); }
+.icon--password { --svg: url("password.svg "); }
+.icon--pencil { --svg: url("pencil.svg "); }
+.icon--person { --svg: url("person.svg "); }
+.icon--picture-add { --svg: url("picture-add.svg "); }
+.icon--picture-double { --svg: url("picture-double.svg "); }
+.icon--picture-remove { --svg: url("picture-remove.svg "); }
+.icon--pinned { --svg: url("pinned.svg "); }
+.icon--pop { --svg: url("pop.svg "); }
+.icon--qr-code { --svg: url("qr-code.svg "); }
+.icon--reaction { --svg: url("reaction.svg "); }
+.icon--refresh { --svg: url("refresh.svg "); }
+.icon--remove-med { --svg: url("remove-med.svg "); }
+.icon--remove { --svg: url("remove.svg "); }
+.icon--rename { --svg: url("rename.svg "); }
+.icon--settings { --svg: url("settings.svg "); }
+.icon--share { --svg: url("share.svg "); }
+.icon--sort-ascending { --svg: url("sort-ascending.svg "); }
+.icon--sort-descending { --svg: url("sort-descending.svg "); }
+.icon--tag { --svg: url("tag.svg "); }
+.icon--temperature { --svg: url("temperature.svg "); }
+.icon--thumb-up { --svg: url("thumb-up.svg "); }
+.icon--trash { --svg: url("trash.svg "); }
+.icon--unpinned { --svg: url("unpinned.svg"); }
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4ceb92d12..a4d9e9ec5 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -3,7 +3,10 @@ module ApplicationHelper
tag.title @page_title || "Fizzy"
end
- def icon_tag(name, aria: { hidden: true }, size: 24, **options)
- image_tag "#{name}.svg", aria: aria, size: size, **options
+ def icon_tag(name, **options)
+ classes = class_names "icon icon--#{name}", options.delete(:class)
+ options["aria-hidden"] = true
+
+ content_tag :span, "", class: classes, **options
end
end
diff --git a/app/helpers/filters_helper.rb b/app/helpers/filters_helper.rb
index 2aa14f29a..b6c8348a4 100644
--- a/app/helpers/filters_helper.rb
+++ b/app/helpers/filters_helper.rb
@@ -2,7 +2,7 @@ module FiltersHelper
def filter_chip_tag(text, params)
link_to bubbles_path(params), class: "btn txt-small btn--remove fill-selected" do
concat tag.span(text)
- concat image_tag("close.svg", aria: { hidden: true }, size: 24)
+ concat icon_tag("close")
end
end
diff --git a/app/helpers/translations_helper.rb b/app/helpers/translations_helper.rb
index 094145099..57107b8f5 100644
--- a/app/helpers/translations_helper.rb
+++ b/app/helpers/translations_helper.rb
@@ -18,7 +18,7 @@ module TranslationsHelper
def translation_button(translation_key)
tag.div(class: "position-relative", data: { controller: "popover", action: "keydown.esc->popover#close click@document->popover#closeOnClickOutside", popover_orientation_top_class: "popover-orientation-top" }) do
tag.button(type: "button", class: "btn", tabindex: -1, data: { action: "popover#toggle" }) do
- concat image_tag("globe.svg", size: 20, role: "presentation", class: "color-icon")
+ concat image_tag("globe.svg", size: 20, role: "presentation")
concat tag.span("Translate", class: "for-screen-reader")
end +
tag.dialog(class: "lanuage-list-menu popover shadow", data: { popover_target: "menu" }) do
diff --git a/app/views/accounts/users/_invite.html.erb b/app/views/accounts/users/_invite.html.erb
index 37128deb4..e064d74bb 100644
--- a/app/views/accounts/users/_invite.html.erb
+++ b/app/views/accounts/users/_invite.html.erb
@@ -11,7 +11,7 @@
<%= tag.button class: "btn", data: { action: "dialog#open" } do %>
- <%= image_tag "qr-code.svg", aria: { hidden: "true" }, size: 24, class: "colorize--black" %>
+ <%= icon_tag "qr-code" %>
Show join link QR code
<% end %>
@@ -28,12 +28,12 @@
<%= button_to_copy_to_clipboard(url) do %>
- <%= image_tag "copy-paste.svg", aria: { hidden: "true" }, size: 24, class: "colorize--black" %>
+ <%= icon_tag "copy-paste" %>
Copy join link
<% end %>
<%= button_to account_join_code_path, method: :put, class: "btn btn--regenerate" do %>
- <%= image_tag "refresh.svg", aria: { hidden: "true" }, size: 24, class: "colorize--black" %>
+ <%= icon_tag "refresh" %>
Regenerate join link
<% end %>
diff --git a/app/views/accounts/users/_user.html.erb b/app/views/accounts/users/_user.html.erb
index bf377bc33..a66de7d15 100644
--- a/app/views/accounts/users/_user.html.erb
+++ b/app/views/accounts/users/_user.html.erb
@@ -9,7 +9,7 @@
diff --git a/app/views/bubbles/_color.html.erb b/app/views/bubbles/_color.html.erb
index b7228aebc..6c2507e38 100644
--- a/app/views/bubbles/_color.html.erb
+++ b/app/views/bubbles/_color.html.erb
@@ -10,7 +10,7 @@
diff --git a/app/views/bubbles/pins/show.html.erb b/app/views/bubbles/pins/show.html.erb
index 7fe838e50..9039cc92f 100644
--- a/app/views/bubbles/pins/show.html.erb
+++ b/app/views/bubbles/pins/show.html.erb
@@ -1,13 +1,13 @@
<%= turbo_frame_tag dom_id(@bubble, :pin) do %>
<% if @bubble.pinned_by? Current.user %>
<%= button_to bucket_bubble_pin_path(@bubble.bucket, @bubble), method: :delete, class: "btn btn--reversed" do %>
- <%= image_tag "pinned.svg", size: 16, aria: { hidden: true } %>
+ <%= icon_tag "pinned" %>
Un-pin this card
<% end %>
<% else %>
<%= button_to bucket_bubble_pin_path(@bubble.bucket, @bubble), class: "btn" do %>
- <%= image_tag "unpinned.svg", size: 16, aria: { hidden: true } %>
+ <%= icon_tag "unpinned" %>
Pin this card
<% end %>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/bubbles/tags/_listbox_option.html.erb b/app/views/bubbles/tags/_listbox_option.html.erb
index b1176ddc0..cea797bf3 100644
--- a/app/views/bubbles/tags/_listbox_option.html.erb
+++ b/app/views/bubbles/tags/_listbox_option.html.erb
@@ -2,6 +2,6 @@
<%= tag.hashtag %>
<% if bubble.tagged_with?(tag) %>
- <%= image_tag "check.svg", aria: { hidden: "true" } %>
+ <%= icon_tag "check" %>
<% end %>
diff --git a/app/views/bubbles/watches/show.html.erb b/app/views/bubbles/watches/show.html.erb
index 79587e78f..435cc030f 100644
--- a/app/views/bubbles/watches/show.html.erb
+++ b/app/views/bubbles/watches/show.html.erb
@@ -1,12 +1,12 @@
<%= turbo_frame_tag dom_id(@bubble, :watch) do %>
<% if @bubble.watched_by? Current.user %>
<%= button_to bucket_bubble_watch_path(@bubble.bucket, @bubble), method: :delete, class: "btn btn--reversed" do %>
- <%= image_tag "bell.svg", size: 16, aria: { hidden: true } %>
+ <%= icon_tag "bell" %>
Stop watching
<% end %>
<% else %>
<%= button_to bucket_bubble_watch_path(@bubble.bucket, @bubble), class: "btn" do %>
- <%= image_tag "bell-off.svg", size: 16, aria: { hidden: true } %>
+ <%= icon_tag "bell-off" %>
Watch this
<% end %>
<% end %>
diff --git a/app/views/buckets/_access_toggle.erb b/app/views/buckets/_access_toggle.erb
index 1b2482ef4..b45067866 100644
--- a/app/views/buckets/_access_toggle.erb
+++ b/app/views/buckets/_access_toggle.erb
@@ -11,7 +11,7 @@
- <%= image_tag "check.svg", size: 20, class: "toggler__visible-when-on colorize--black flex-item-no-shrink", aria: { hidden: "true" } %>
+ <%= icon_tag "check", class: "toggler__visible-when-on" %>
<%= form.button class: "btn btn--reversed", type: "submit" do %>
- <%= image_tag "check.svg", aria: { hidden: "true" } %>
+ <%= icon_tag "check" %>
Submit
<% end %>
<%= link_to bucket_bubble_comment_reactions_path(@comment.bubble.bucket, @comment.bubble, @comment), role: "button",
data: { turbo_frame: dom_id(@comment, :reactions), form_target: "cancel" }, class: "btn btn--negative" do %>
- <%= image_tag "minus.svg", aria: { hidden: "true" } %>
+ <%= icon_tag "minus" %>
Cancel
<% end %>
<% end %>
diff --git a/app/views/events/_event.html.erb b/app/views/events/_event.html.erb
index 42488dc90..ee2d7b21b 100644
--- a/app/views/events/_event.html.erb
+++ b/app/views/events/_event.html.erb
@@ -5,7 +5,7 @@
class: "event panel center center-block flex-inline align-start justify-start gap position-relative",
style: "--bubble-color: #{ bubble.color }; background-color: color-mix(in srgb, var(--bubble-color) 10%, var(--color-bg));
color: color-mix(in srgb, var(--bubble-color) 40%, var(--color-ink));",
- data: { related_element_target: "related",
+ data: { related_element_target: "related",
related_element_group_value: bubble.id,
action: "mouseover->related-element#highlight mouseout->related-element#unhighlight" } do %>
@@ -19,8 +19,8 @@
<% if event_column(event) == 2 %>
-
- <%= image_tag "#{event_action_icon(event)}.svg", size: 24, aria: { hidden: true }, class: "colorize--white" %>
+
+ <%= icon_tag event_action_icon(event) %>
<% end %>
diff --git a/app/views/events/_filter.html.erb b/app/views/events/_filter.html.erb
index bca5bbeb7..b791ea1c7 100644
--- a/app/views/events/_filter.html.erb
+++ b/app/views/events/_filter.html.erb
@@ -7,22 +7,22 @@
-