Skip to content

Commit 5066fe3

Browse files
committed
Refactor designs
1 parent 5939c45 commit 5066fe3

File tree

2 files changed

+25
-33
lines changed

2 files changed

+25
-33
lines changed

app/assets/stylesheets/_rating.css

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
.rating-container {
2-
display: flex;
3-
justify-content: space-between;
4-
align-items: center;
5-
width: 100%;
6-
gap: 12px;
7-
}
8-
9-
.average-rating {
10-
display: flex;
11-
align-items: center;
12-
margin-left: 4px;
13-
gap: 4px;
14-
}
15-
161
.rating-items {
172
display: flex;
183
align-items: center;
194
flex-direction: row-reverse;
5+
6+
@media (max-width: 450px) {
7+
.mdc-icon-button {
8+
width: 32px;
9+
}
10+
}
2011
}
2112

2213
.interactive-star {

app/views/subjects/_rating.html.erb

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<div class="mdc-deprecated-list-item non-clickable-list-item">
2-
Puntuación:
3-
<div class="rating-container">
4-
<div class="average-rating">
5-
<span class="material-icons">star</span>
6-
<%= @subject.average_rating || "Sin calificar" %>
7-
</div>
8-
<div class="rating-items">
9-
<% 5.downto(1).each do |value| %>
10-
<% filled = @user_review.present? && @user_review.rating >= value %>
11-
<% selected = @user_review.present? && @user_review.rating == value %>
12-
<% url = selected ? review_path(@user_review) : reviews_path %>
13-
<% method = selected ? :delete : :post %>
14-
<%= form_with(url:, method:, class: "interactive-star") do |f| %>
15-
<%= f.hidden_field :subject_id, value: @subject.id %>
16-
<%= f.hidden_field :rating, value: %>
17-
<%= f.button filled ? 'star' : 'star_outline', class: "material-icons mdc-icon-button" %>
18-
<% end %>
2+
<span class="mdc-deprecated-list-item__text">
3+
Puntuación: <%= @subject.average_rating || "Sin calificar" %>
4+
</span>
5+
</div>
6+
<div class="mdc-deprecated-list-item non-clickable-list-item">
7+
<span class="mdc-deprecated-list-item__text">
8+
Tu puntuación:
9+
</span>
10+
<div class="rating-items">
11+
<% 5.downto(1).each do |value| %>
12+
<% filled = @user_review.present? && @user_review.rating >= value %>
13+
<% selected = @user_review.present? && @user_review.rating == value %>
14+
<% url = selected ? review_path(@user_review) : reviews_path %>
15+
<% method = selected ? :delete : :post %>
16+
<%= form_with(url:, method:, class: "interactive-star") do |f| %>
17+
<%= f.hidden_field :subject_id, value: @subject.id %>
18+
<%= f.hidden_field :rating, value: %>
19+
<%= f.button filled ? 'star' : 'star_outline', class: "material-icons mdc-icon-button" %>
1920
<% end %>
20-
</div>
21+
<% end %>
2122
</div>
2223
</div>

0 commit comments

Comments
 (0)