Skip to content

Commit 55ff0fb

Browse files
committed
refactor/Use inline svgs for topbar
1 parent 2eab4be commit 55ff0fb

File tree

8 files changed

+21
-6
lines changed

8 files changed

+21
-6
lines changed

app/assets/stylesheets/_sidebar.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
&--notification {
3232
text-align: center;
3333
position: absolute;
34-
top: 4px;
35-
left: 30px;
34+
top: 0px;
35+
right: 10px;
3636
width: 14px;
3737
height: 14px;
3838
background-color: $color-red;

app/views/shared/_folder.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
data-folders-target="folder"
66
data-folder-id="<%= folder.id %>"
77
>
8-
<svg class="m-auto w-10 h-10 text-gray-200" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path></svg>
8+
<%= render partial: 'shared/icons/folder', locals: { color: 'text-gray-200', width: 10, height: 10 } %>
99
<div>
1010
<h5 class="text-center"><%= folder.name %></h5>
1111
<%= render partial: 'folders/counts', locals: { folder: folder } %>

app/views/shared/_nav_item.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<% active = path == request.path %>
22

3-
<% color = active ? 'primary' : 'black' %>
3+
<% color = active ? 'text-cyan' : 'text-gray-400 hover:text-cyan transition' %>
44
<% css_class = active ? 'active' : 'inactive' %>
55

6-
<%= link_to(path, class: 'position-relative') do %>
7-
<%= image_tag("/icons/#{color}/#{icon}.svg", class: "w-10 nav-item--#{css_class}") %>
6+
<%= link_to(path, class: 'relative px-3') do %>
7+
<%= render partial: "shared/icons/#{icon}", locals: { width: 7, height: 7, color: color } %>
88
<% if path == notifications_path %>
99
<%= notification_counter(current_user) %>
1010
<% end %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<svg class="w-<%= width %> h-<%= height %> <%= color %>" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2+
<path d="M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zM10 18a3 3 0 01-3-3h6a3 3 0 01-3 3z"></path>
3+
</svg>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<svg class="w-<%= width %> h-<%= height %> <%= color %>" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2+
<path d="M8 9a3 3 0 100-6 3 3 0 000 6zM8 11a6 6 0 016 6H2a6 6 0 016-6zM16 7a1 1 0 10-2 0v1h-1a1 1 0 100 2h1v1a1 1 0 102 0v-1h1a1 1 0 100-2h-1V7z"></path>
3+
</svg>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<svg class="m-auto w-<%= width %> h-<%= height %> <%= color %>" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2+
<path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path>
3+
</svg>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<svg class="w-<%= width %> h-<%= height %> <%= color %>" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2+
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"></path>
3+
</svg>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<svg class="w-<%= width %> h-<%= height %> <%= color %>" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2+
<path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z" clip-rule="evenodd"></path>
3+
</svg>

0 commit comments

Comments
 (0)