Skip to content

Commit

Permalink
Add <symbol> for a selected seat
Browse files Browse the repository at this point in the history
When rendering the list of `Seat` records for a `Floor`, render [`<use>`
elements][use] referring to the new `#seat-icon-selected` version of a
seat based on whether or not they're in the visitor's `Cart`.

Desktop
---

![selected seat icon](https://user-images.githubusercontent.com/2575027/77386360-0288da80-6d61-11ea-8d80-fe46c3f53706.png)

[use]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use
  • Loading branch information
seanpdoyle committed May 29, 2020
1 parent 60c9cb2 commit de0bd45
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/views/seats/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
<circle fill="#37b24d" r="12" cx="12" cy="12"></circle>
<circle fill="#ffffff" r="6" cx="12" cy="12"></circle>
</symbol>

<symbol
id="seat-icon-selected"
width="24"
height="24"
viewbox="0 0 24 24"
>
<circle fill="#37b24d" r="12" cx="12" cy="12"></circle>
</symbol>
</svg>

<% sections.each do |section| %>
Expand All @@ -39,7 +48,11 @@
aria-label="<%= seat.row_number %>"
>
<use
xlink:href="#seat-icon-unselected"
<% if Current.cart.include?(seat) %>
xlink:href="#seat-icon-selected"
<% else %>
xlink:href="#seat-icon-unselected"
<% end %>
width="12px"
height="12px"
x="<%= seat.x %>"
Expand Down

0 comments on commit de0bd45

Please sign in to comment.