Skip to content

Commit

Permalink
Add inline_svg gem
Browse files Browse the repository at this point in the history
Extract the `<svg>` element that served as our `<dialog>` element's
"Close modal" button.

Store the `.svg` file in `app/assets/images/icons`, making it available
to the [`inline_svg_tag`-provided helper][gem].

[gem]: https://github.com/jamesmartin/inline_svg/tree/v1.7.1#usage
  • Loading branch information
seanpdoyle committed May 29, 2020
1 parent 438868d commit c4ec5bc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'inline_svg'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ GEM
activesupport (>= 4.2.0)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
inline_svg (1.7.1)
activesupport (>= 3.0)
nokogiri (>= 1.6)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
listen (3.1.5)
Expand Down Expand Up @@ -206,6 +209,7 @@ DEPENDENCIES
byebug
capybara (>= 2.15)
factory_bot (~> 5.0.0)
inline_svg
jbuilder (~> 2.7)
listen (>= 3.0.5, < 3.2)
pg (>= 0.18, < 2.0)
Expand Down
15 changes: 15 additions & 0 deletions app/assets/images/icons/x-circle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 6 additions & 17 deletions app/views/seats/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,12 @@
<button
class="syos-button syos-button--transparent"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"
class="syos-icon syos-icon--large"
title="Close modal"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10"></circle>
<line x1="15" y1="9" x2="9" y2="15"></line>
<line x1="9" y1="9" x2="15" y2="15"></line>
</svg>
<%= inline_svg_tag(
"icons/x-circle.svg",
aria: true,
class: "syos-icon syos-icon--large",
title: "Close modal",
) %>
</button>
</form>
</header>
Expand Down

0 comments on commit c4ec5bc

Please sign in to comment.