Skip to content

Commit 8cf08b9

Browse files
committed
refactor css
1 parent 94a6b7e commit 8cf08b9

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

app/assets/stylesheets/application.css

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,27 @@ th {
2424
.inline-form {
2525
display: inline;
2626
}
27-
.approve-btn {
28-
background-color: #4CAF50;
27+
28+
/* Reusable button base style */
29+
.btn {
2930
color: white;
3031
border: none;
3132
padding: 6px 12px;
3233
margin-left: 4px;
3334
border-radius: 4px;
3435
cursor: pointer;
3536
}
37+
38+
/* Specific button variants */
39+
.approve-btn {
40+
background-color: #4CAF50;
41+
}
42+
3643
.reject-btn {
3744
background-color: #f44336;
38-
color: white;
39-
border: none;
40-
padding: 6px 12px;
41-
margin-left: 4px;
42-
border-radius: 4px;
43-
cursor: pointer;
4445
}
4546

4647
.pending-btn {
4748
background-color: yellow;
4849
color: black;
49-
border: none;
50-
padding: 6px 12px;
51-
margin-left: 4px;
52-
border-radius: 4px;
53-
cursor: pointer;
5450
}

app/views/puzzles/_puzzles_table.html.erb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
</td>
2323
<td>
2424
<% if actions == :pending %>
25-
<%= button_to 'Approve', puzzle_state_path(puzzle, state: :approved), method: :patch, form_class: 'inline-form', class: 'approve-btn' %>
26-
<%= button_to 'Reject', puzzle_state_path(puzzle, state: :rejected), method: :patch, form_class: 'inline-form', class: 'reject-btn' %>
25+
<%= button_to 'Approve', puzzle_state_path(puzzle, state: :approved), method: :patch, form_class: 'inline-form', class: 'btn approve-btn' %>
26+
<%= button_to 'Reject', puzzle_state_path(puzzle, state: :rejected), method: :patch, form_class: 'inline-form', class: 'btn reject-btn' %>
2727
<% elsif actions == :approved %>
28-
<%= button_to 'Reject', puzzle_state_path(puzzle, state: :rejected), method: :patch, form_class: 'inline-form', class: 'reject-btn' %>
29-
<%= button_to 'Pending', puzzle_state_path(puzzle, state: :pending), method: :patch, form_class: 'inline-form', class: 'pending-btn' %>
28+
<%= button_to 'Reject', puzzle_state_path(puzzle, state: :rejected), method: :patch, form_class: 'inline-form', class: 'btn reject-btn' %>
29+
<%= button_to 'Pending', puzzle_state_path(puzzle, state: :pending), method: :patch, form_class: 'inline-form', class: 'btn pending-btn' %>
3030
<% elsif actions == :rejected %>
31-
<%= button_to 'Approve', puzzle_state_path(puzzle, state: :approved), method: :patch, form_class: 'inline-form', class: 'approve-btn' %>
32-
<%= button_to 'Pending', puzzle_state_path(puzzle, state: :pending), method: :patch, form_class: 'inline-form', class: 'pending-btn' %>
31+
<%= button_to 'Approve', puzzle_state_path(puzzle, state: :approved), method: :patch, form_class: 'inline-form', class: 'btn approve-btn' %>
32+
<%= button_to 'Pending', puzzle_state_path(puzzle, state: :pending), method: :patch, form_class: 'inline-form', class: 'btn pending-btn' %>
3333
<% end %>
3434
</td>
3535
</tr>

0 commit comments

Comments
 (0)