Add custom SVG icons to navbar links

pull/749/head
Ryan Arthur 6 years ago
parent 7987e82e6f
commit 7b95fdbcbb
  1. 10
      apps/block_scout_web/assets/css/_elements.scss
  2. 27
      apps/block_scout_web/assets/css/components/_navbar.scss
  3. 2
      apps/block_scout_web/assets/css/theme/_base_variables.scss
  4. 2
      apps/block_scout_web/assets/css/theme/_poa_variables.scss
  5. 3
      apps/block_scout_web/assets/static/images/icons/api.svg
  6. 3
      apps/block_scout_web/assets/static/images/icons/blocks.svg
  7. 3
      apps/block_scout_web/assets/static/images/icons/network.svg
  8. 3
      apps/block_scout_web/assets/static/images/icons/search.svg
  9. 3
      apps/block_scout_web/assets/static/images/icons/transactions.svg
  10. 3
      apps/block_scout_web/lib/block_scout_web/templates/icons/_api_icon.html.eex
  11. 4
      apps/block_scout_web/lib/block_scout_web/templates/icons/_block_icon.html.eex
  12. 3
      apps/block_scout_web/lib/block_scout_web/templates/icons/_network_icon.html.eex
  13. 3
      apps/block_scout_web/lib/block_scout_web/templates/icons/_search_icon.html.eex
  14. 4
      apps/block_scout_web/lib/block_scout_web/templates/icons/_transaction_icon.html.eex
  15. 29
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex

@ -3,3 +3,13 @@ hr {
border-style: solid;
border-color: $gray-300 transparent transparent transparent;
}
svg {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
}

@ -30,6 +30,21 @@
color: $white;
}
.navbar-nav .nav-link {
display: flex;
align-items: center;
}
.nav-link-icon {
height: 1.5em;
width: 1.5em;
margin-right: 0.75em;
path {
fill: $secondary;
}
}
.navbar .form-control {
background: transparent;
width: auto;
@ -70,10 +85,10 @@
.input-group-append {
margin-left: 0px;
}
.fa-search {
color: $white;
path {
fill: $secondary;
}
}
.topnav-nav-link {
@ -88,15 +103,15 @@
left: 50%;
width: 75%;
height: 0.2rem;
background-color: $white;
background-color: $secondary;
border-radius: 4px 4px 0 0;
opacity: 0;
transform: translateX(-50%);
transition: all 0.2s ease;
}
&:hover {
&:before {
&:before{
opacity: 1;
}
}

@ -58,7 +58,7 @@ $colors: map-merge((
), $colors);
$primary: $indigo !default;
$secondary: $teal !default;
$secondary: #7dd79f !default;
$tertiary: $purple !default;
$success: $green !default;
$info: $cyan !default;

@ -1,3 +1,3 @@
$primary: $indigo;
$secondary: $teal;
$secondary: #7dd79f;
$tertiary: $purple;

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M21 12h-2.184A2.99 2.99 0 0 1 16 14a2.99 2.99 0 0 1-2.816-2H1a1 1 0 0 1 0-2h12.184A2.99 2.99 0 0 1 16 8a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2zm-5-2a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm5-6H8.816A2.99 2.99 0 0 1 6 6a2.99 2.99 0 0 1-2.816-2H1a1 1 0 0 1 0-2h2.184A2.99 2.99 0 0 1 6 0a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2zM6 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2zM1 18h2.184A2.99 2.99 0 0 1 6 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H8.816A2.99 2.99 0 0 1 6 22a2.99 2.99 0 0 1-2.816-2H1a1 1 0 0 1 0-2zm5 2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/>
</svg>

After

Width:  |  Height:  |  Size: 647 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M20 6.023v9.823a.944.944 0 0 1-.076.529c-.005.014-.014.026-.02.04a.94.94 0 0 1-.17.252c-.037.041-.08.071-.123.105-.039.03-.066.069-.11.094l-8.966 5c-.039.022-.081.028-.122.04-.029.013-.06.018-.09.029l-.019.006c-.029.009-.054.02-.083.027-.032.006-.062.004-.093.006-.044.006-.083.026-.128.026s-.084-.02-.128-.026c-.031-.002-.061 0-.093-.006-.029-.007-.054-.018-.083-.027l-.019-.006c-.03-.011-.061-.016-.09-.029-.041-.012-.083-.018-.122-.04l-8.966-5c-.044-.025-.071-.064-.11-.094-.043-.034-.086-.064-.123-.105a.94.94 0 0 1-.17-.252c-.006-.014-.015-.026-.02-.04A.944.944 0 0 1 0 15.846V6.023L-.002 6c0-.064.001-.125.014-.188a.948.948 0 0 1 .062-.179l.011-.032c.012-.034.016-.069.035-.101.011-.018.03-.028.042-.045.023-.035.054-.063.084-.092a.964.964 0 0 1 .143-.135c.021-.018.04-.039.064-.054.017-.012.028-.03.046-.04l8.966-5c.074-.041.153-.053.231-.075.029-.009.054-.02.083-.027.075-.015.146-.016.221-.015.075-.001.146 0 .221.015.029.007.054.018.083.027.078.022.157.034.231.075l8.966 5c.018.01.029.028.046.04.024.015.043.036.064.054.053.042.1.084.143.135.03.029.061.057.084.092.012.017.031.027.042.045.019.032.023.067.035.101l.011.032a.948.948 0 0 1 .062.179.911.911 0 0 1 .014.188L20 6.023zm-18 9.37l7 3.904v-7.69L2 7.703v7.69zm8-13.248L3.088 6 10 9.855 16.912 6 10 2.145zm8 5.558l-7 3.904v7.69l7-3.904v-7.69z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M11 22C4.925 22 0 17.075 0 11S4.925 0 11 0s11 4.925 11 11-4.925 11-11 11zm7.466-6h-3.019c-.304 1.3-.717 2.457-1.219 3.394A9.038 9.038 0 0 0 18.466 16zM11 20c1.04 0 1.956-1.589 2.494-4H8.506c.538 2.411 1.454 4 2.494 4zm-3.228-.606C7.27 18.457 6.857 17.3 6.553 16H3.534a9.038 9.038 0 0 0 4.238 3.394zM2.531 8A8.93 8.93 0 0 0 2 11c0 1.055.197 2.06.531 3h3.666A23.281 23.281 0 0 1 6 11c0-1.043.073-2.045.197-3H2.531zm1.003-2h3.019c.304-1.3.717-2.457 1.219-3.394A9.038 9.038 0 0 0 3.534 6zM11 2C9.96 2 9.044 3.589 8.506 6h4.988C12.956 3.589 12.04 2 11 2zm2.826 6H8.174A25.64 25.64 0 0 0 8 11c0 1.054.063 2.06.174 3h5.652c.111-.94.174-1.946.174-3s-.063-2.06-.174-3zm.402-5.394c.502.937.915 2.094 1.219 3.394h3.019a9.038 9.038 0 0 0-4.238-3.394zM19.469 8h-3.666c.124.955.197 1.957.197 3s-.073 2.045-.197 3h3.666A8.93 8.93 0 0 0 20 11a8.93 8.93 0 0 0-.531-3z"/>
</svg>

After

Width:  |  Height:  |  Size: 973 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17">
<path fill="#7DD79F" fill-rule="evenodd" d="M15.713 15.727a.982.982 0 0 1-1.388 0l-2.289-2.29C10.773 14.403 9.213 15 7.5 15A7.5 7.5 0 1 1 15 7.5c0 1.719-.602 3.285-1.575 4.55l2.288 2.288a.983.983 0 0 1 0 1.389zM7.5 2a5.5 5.5 0 1 0 0 11 5.5 5.5 0 1 0 0-11z"/>
</svg>

After

Width:  |  Height:  |  Size: 334 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M20 22H2a2 2 0 0 1-2-2v-2a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2zM3 18a1 1 0 0 0 0 2h2v-2H3zm16 0H7v2h12a1 1 0 0 0 0-2zm1-4H2a2 2 0 0 1-2-2v-2a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2zM5 10H3a1 1 0 0 0 0 2h2v-2zm14 0H7v2h12a1 1 0 0 0 0-2zm1-4H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2zM5 2H3a1 1 0 0 0 0 2h2V2zm14 0H7v2h12a1 1 0 0 0 0-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 497 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M21 12h-2.184A2.99 2.99 0 0 1 16 14a2.99 2.99 0 0 1-2.816-2H1a1 1 0 0 1 0-2h12.184A2.99 2.99 0 0 1 16 8a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2zm-5-2a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm5-6H8.816A2.99 2.99 0 0 1 6 6a2.99 2.99 0 0 1-2.816-2H1a1 1 0 0 1 0-2h2.184A2.99 2.99 0 0 1 6 0a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2zM6 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2zM1 18h2.184A2.99 2.99 0 0 1 6 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H8.816A2.99 2.99 0 0 1 6 22a2.99 2.99 0 0 1-2.816-2H1a1 1 0 0 1 0-2zm5 2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/>
</svg>

After

Width:  |  Height:  |  Size: 647 B

@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="24">
<path fill="#5d6165" fill-rule="evenodd" d="M21.998 17.936c0 .006-.004.011-.004.017.009.185-.013.374-.105.547a.892.892 0 0 1-.816.485c-.019.002-.036.011-.055.011l-9.467 4.887a1.11 1.11 0 0 1-.519.111A.113.113 0 0 1 11 24c-.011 0-.021-.006-.032-.006-.052 0-.104-.009-.156-.014-.018-.004-.038-.001-.056-.005a.984.984 0 0 1-.308-.092l-9.425-4.888c-.008 0-.015.005-.023.005-.03 0-.055-.013-.084-.015a.895.895 0 0 1-.805-.485 1.038 1.038 0 0 1-.105-.547c-.002-.01-.006-.019-.006-.03v-.046c.001-.031-.005-.061 0-.092V6.188c-.005-.031.001-.061 0-.092v-.019l.002-.013c0-.043.004-.086.01-.128a.788.788 0 0 1 .114-.459.98.98 0 0 1 .407-.336.928.928 0 0 1 .18-.079c.038-.01.074-.017.112-.024.053-.01.103-.03.157-.034L10.448.117c.156-.081.323-.103.49-.105C10.96.011 10.978 0 11 0s.04.011.062.012c.167.002.334.024.489.104l9.537 4.902c.179.021.343.09.483.199a.613.613 0 0 1 .058.042c.042.037.08.073.116.116.042.044.095.078.129.131.072.111.098.23.109.349A.826.826 0 0 1 22 6.16v11.652c.005.031-.001.062 0 .093v.018l-.002.013zM2 16.159l1.633-1.025c.44-.276 1.002-.112 1.256.366s.103 1.09-.337 1.366l-1.565.983L10 21.486v-8.645l-1.633 1.025c-.44.276-1.002.112-1.256-.366s-.103-1.09.337-1.366l1.573-.988L2 7.522v8.637zM12 2.492V4a1 1 0 0 1-2 0V2.503L3.226 6 10 9.497V8a1 1 0 0 1 2 0v1.508L18.825 6 12 2.492zm8 5.05l-7.017 3.606 1.569.986c.44.276.591.888.337 1.366-.254.478-.816.642-1.256.366L12 12.841v8.656l7.037-3.633-1.589-.998c-.44-.276-.591-.888-.337-1.366.254-.478.816-.642 1.256-.366L20 16.159V7.542z"/>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M20 6.023v9.823a.944.944 0 0 1-.076.529c-.005.014-.014.026-.02.04a.94.94 0 0 1-.17.252c-.037.041-.08.071-.123.105-.039.03-.066.069-.11.094l-8.966 5c-.039.022-.081.028-.122.04-.029.013-.06.018-.09.029l-.019.006c-.029.009-.054.02-.083.027-.032.006-.062.004-.093.006-.044.006-.083.026-.128.026s-.084-.02-.128-.026c-.031-.002-.061 0-.093-.006-.029-.007-.054-.018-.083-.027l-.019-.006c-.03-.011-.061-.016-.09-.029-.041-.012-.083-.018-.122-.04l-8.966-5c-.044-.025-.071-.064-.11-.094-.043-.034-.086-.064-.123-.105a.94.94 0 0 1-.17-.252c-.006-.014-.015-.026-.02-.04A.944.944 0 0 1 0 15.846V6.023L-.002 6c0-.064.001-.125.014-.188a.948.948 0 0 1 .062-.179l.011-.032c.012-.034.016-.069.035-.101.011-.018.03-.028.042-.045.023-.035.054-.063.084-.092a.964.964 0 0 1 .143-.135c.021-.018.04-.039.064-.054.017-.012.028-.03.046-.04l8.966-5c.074-.041.153-.053.231-.075.029-.009.054-.02.083-.027.075-.015.146-.016.221-.015.075-.001.146 0 .221.015.029.007.054.018.083.027.078.022.157.034.231.075l8.966 5c.018.01.029.028.046.04.024.015.043.036.064.054.053.042.1.084.143.135.03.029.061.057.084.092.012.017.031.027.042.045.019.032.023.067.035.101l.011.032a.948.948 0 0 1 .062.179.911.911 0 0 1 .014.188L20 6.023zm-18 9.37l7 3.904v-7.69L2 7.703v7.69zm8-13.248L3.088 6 10 9.855 16.912 6 10 2.145zm8 5.558l-7 3.904v7.69l7-3.904v-7.69z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M11 22C4.925 22 0 17.075 0 11S4.925 0 11 0s11 4.925 11 11-4.925 11-11 11zm7.466-6h-3.019c-.304 1.3-.717 2.457-1.219 3.394A9.038 9.038 0 0 0 18.466 16zM11 20c1.04 0 1.956-1.589 2.494-4H8.506c.538 2.411 1.454 4 2.494 4zm-3.228-.606C7.27 18.457 6.857 17.3 6.553 16H3.534a9.038 9.038 0 0 0 4.238 3.394zM2.531 8A8.93 8.93 0 0 0 2 11c0 1.055.197 2.06.531 3h3.666A23.281 23.281 0 0 1 6 11c0-1.043.073-2.045.197-3H2.531zm1.003-2h3.019c.304-1.3.717-2.457 1.219-3.394A9.038 9.038 0 0 0 3.534 6zM11 2C9.96 2 9.044 3.589 8.506 6h4.988C12.956 3.589 12.04 2 11 2zm2.826 6H8.174A25.64 25.64 0 0 0 8 11c0 1.054.063 2.06.174 3h5.652c.111-.94.174-1.946.174-3s-.063-2.06-.174-3zm.402-5.394c.502.937.915 2.094 1.219 3.394h3.019a9.038 9.038 0 0 0-4.238-3.394zM19.469 8h-3.666c.124.955.197 1.957.197 3s-.073 2.045-.197 3h3.666A8.93 8.93 0 0 0 20 11a8.93 8.93 0 0 0-.531-3z"/>
</svg>

After

Width:  |  Height:  |  Size: 973 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17">
<path fill="#7DD79F" fill-rule="evenodd" d="M15.713 15.727a.982.982 0 0 1-1.388 0l-2.289-2.29C10.773 14.403 9.213 15 7.5 15A7.5 7.5 0 1 1 15 7.5c0 1.719-.602 3.285-1.575 4.55l2.288 2.288a.983.983 0 0 1 0 1.389zM7.5 2a5.5 5.5 0 1 0 0 11 5.5 5.5 0 1 0 0-11z"/>
</svg>

After

Width:  |  Height:  |  Size: 334 B

@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<path fill="#BAC4CB" fill-rule="evenodd" d="M23 19H12.427l3.284 3.284a1.01 1.01 0 0 1-1.427 1.427l-4.995-4.995A1.01 1.01 0 0 1 8.994 18c0-.259.098-.519.295-.716l4.995-4.995a1.01 1.01 0 0 1 1.427 1.427L12.427 17H23a1 1 0 0 1 0 2zM14.711 6.716l-4.995 4.995a1.01 1.01 0 0 1-1.427-1.427L11.573 7H1a1 1 0 0 1 0-2h10.573L8.289 1.716A1.01 1.01 0 0 1 9.716.289l4.995 4.995c.197.197.295.457.295.716 0 .259-.098.519-.295.716z"/>
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22">
<path fill="#2CDC8F" fill-rule="evenodd" d="M20 22H2a2 2 0 0 1-2-2v-2a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2zM3 18a1 1 0 0 0 0 2h2v-2H3zm16 0H7v2h12a1 1 0 0 0 0-2zm1-4H2a2 2 0 0 1-2-2v-2a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2zM5 10H3a1 1 0 0 0 0 2h2v-2zm14 0H7v2h12a1 1 0 0 0 0-2zm1-4H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2zM5 2H3a1 1 0 0 0 0 2h2V2zm14 0H7v2h12a1 1 0 0 0 0-2z"/>
</svg>

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 497 B

@ -10,13 +10,21 @@
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<%= link to: block_path(@conn, :index), class: "nav-link topnav-nav-link" do %>
<i class="fas fa-cube mr-1"></i>
<!-- <i class="fas fa-cube mr-1 text-secondary"></i> -->
<!-- <img src="<%= static_path(@conn, "/images/icons/blocks.svg") %>" class="nav-link-icon"> -->
<span class="nav-link-icon">
<%= render BlockScoutWeb.IconsView, "_block_icon.html" %>
</span>
<%= gettext("Blocks") %>
<% end %>
</li>
<li class="nav-item">
<%= link to: transaction_path(@conn, :index), class: "nav-link topnav-nav-link" do %>
<i class="fas fa-th-list mr-1"></i>
<!-- <i class="fas fa-th-list mr-1 text-secondary"></i> -->
<!-- <img src="<%= static_path(@conn, "/images/icons/transactions.svg") %>" class="nav-link-icon"> -->
<span class="nav-link-icon">
<%= render BlockScoutWeb.IconsView, "_transaction_icon.html" %>
</span>
<%= gettext("Transactions") %>
<% end %>
</li>
@ -27,7 +35,11 @@
</li>
<li class="nav-item">
<%= link to: api_docs_path(@conn, :index), class: "nav-link topnav-nav-link" do %>
<i class="fas fa-sliders-h mr-1"></i>
<!-- <i class="fas fa-sliders-h mr-1 text-secondary"></i> -->
<!-- <img src="<%= static_path(@conn, "/images/icons/api.svg") %>" class="nav-link-icon"> -->
<span class="nav-link-icon">
<%= render BlockScoutWeb.IconsView, "_api_icon.html" %>
</span>
<%= gettext("API") %>
<% end %>
</li>
@ -36,7 +48,10 @@
<div class="input-group">
<%= search_input f, :q, class: 'form-control mr-auto', placeholder: gettext("Search by address, transaction hash, or block number"), "aria-describedby": "search-icon", "aria-label": gettext("Search"), "data-test": "search_input" %>
<div class="input-group-append">
<button class="input-group-text" id="search-icon"><i class="fas fa-search"></i></button>
<button class="input-group-text" id="search-icon">
<!-- <i class="fas fa-search text-secondary"></i> -->
<%= render BlockScoutWeb.IconsView, "_search_icon.html" %>
</button>
</div>
</div>
<button class="btn btn-outline-success my-2 my-sm-0 sr-only" type="submit"><%= gettext "Search" %></button>
@ -44,7 +59,11 @@
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-globe mr-1"></i>
<!-- <i class="fas fa-globe mr-1 text-secondary"></i> -->
<!-- <img src="<%= static_path(@conn, "/images/icons/network.svg") %>" class="nav-link-icon"> -->
<span class="nav-link-icon">
<%= render BlockScoutWeb.IconsView, "_network_icon.html" %>
</span>
<%= gettext("Mainnet") %>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">

Loading…
Cancel
Save