Skip to content

Commit 71fe47a

Browse files
authored
Tweak survey styles (forem#22762)
1 parent 1882334 commit 71fe47a

File tree

2 files changed

+17
-61
lines changed

2 files changed

+17
-61
lines changed

app/assets/stylesheets/ltags/SurveyTag.scss

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
background-color: var(--theme-container-background, white);
1313
border-radius: var(--radius-lg, 5px);
1414
box-sizing: border-box;
15-
padding: 15px 25px 25px;
15+
padding: calc(4px + 0.6vw) calc(7px + 0.6vw) calc(7px + 0.6vw);
1616
font-family: var(--ff-sans-serif);
1717

1818
.survey-title {
@@ -30,13 +30,15 @@
3030
margin-bottom: 1em;
3131

3232
h3 {
33-
margin: 15px 0px 20px !important;
33+
margin: 15px 0px 16px !important;
3434
font-size: 1.05em !important;
3535
font-weight: 500 !important;
3636
color: var(--body-color);
37-
padding: 28px 0;
38-
border-bottom: 1px solid var(--form-border, #eee);
39-
border-top: 1px solid var(--form-border, #eee);
37+
padding: var(--su-2) var(--su-2) !important;
38+
border: 1px solid var(--form-border, #eee);
39+
border-radius: var(--radius-md, 5px);
40+
background-color: rgba(0, 0, 0, 0.05);
41+
4042
}
4143

4244
&.survey-poll-long-question {
@@ -56,42 +58,19 @@
5658

5759
&.survey-poll-answers-grid {
5860
display: grid;
59-
grid-template-rows: repeat(2, auto);
60-
grid-auto-flow: column;
61+
grid-template-columns: repeat(2, 1fr);
62+
grid-auto-flow: row;
6163
gap: 10px;
62-
overflow-x: auto;
63-
padding-bottom: 8px;
64-
65-
/* Custom scrollbar for horizontal grid */
66-
&::-webkit-scrollbar {
67-
height: 4px;
68-
}
69-
70-
&::-webkit-scrollbar-track {
71-
background: rgba(0, 0, 0, 0.05);
72-
}
73-
74-
&::-webkit-scrollbar-thumb {
75-
background: rgba(0, 0, 0, 0.1);
76-
border-radius: 4px;
77-
}
7864

7965
.survey-poll-option {
80-
padding: 8px 12px;
81-
font-size: 0.9em;
82-
min-width: max-content;
66+
padding: 3px 8px;
67+
font-size: calc(0.8em + 0.1vw);
8368

8469
.option-text {
85-
white-space: nowrap;
70+
white-space: normal;
8671
}
8772
}
8873

89-
@media (max-width: $breakpoint-m) {
90-
grid-template-rows: none;
91-
grid-auto-flow: row;
92-
grid-template-columns: 1fr;
93-
overflow-x: visible;
94-
}
9574
}
9675

9776
.survey-poll-option {

app/views/surveys/show.html.erb

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,42 +51,19 @@
5151
/* Sharing styles with SurveyTag.scss aesthetic but adapted for standalone view */
5252
.survey-poll-answers-grid {
5353
display: grid !important;
54-
grid-template-rows: repeat(2, auto) !important;
55-
grid-auto-flow: column !important;
54+
grid-template-columns: repeat(2, 1fr) !important;
55+
grid-auto-flow: row !important;
5656
gap: 10px !important;
57-
overflow-x: auto !important;
58-
padding-bottom: 8px !important;
5957
flex-direction: row !important; /* Override column for flex containers */
6058
}
6159

62-
.survey-poll-answers-grid::-webkit-scrollbar {
63-
height: 4px;
64-
}
65-
.survey-poll-answers-grid::-webkit-scrollbar-track {
66-
background: rgba(0, 0, 0, 0.05);
67-
}
68-
.survey-poll-answers-grid::-webkit-scrollbar-thumb {
69-
background: rgba(0, 0, 0, 0.1);
70-
border-radius: 4px;
71-
}
72-
7360
.survey-poll-answers-grid .survey-poll-option {
74-
padding: 8px 12px !important;
75-
min-width: max-content !important;
61+
padding: 10px 15px !important;
7662
}
7763

7864
.survey-poll-answers-grid .option-text,
7965
.survey-poll-answers-grid button {
80-
font-size: 0.9em !important;
81-
white-space: nowrap !important;
82-
}
83-
84-
@media (max-width: 640px) {
85-
.survey-poll-answers-grid {
86-
grid-template-rows: none !important;
87-
grid-auto-flow: row !important;
88-
grid-template-columns: 1fr !important;
89-
overflow-x: visible !important;
90-
}
66+
font-size: 0.95em !important;
67+
white-space: normal !important;
9168
}
9269
</style>

0 commit comments

Comments
 (0)