Skip to content

Commit 35d7d82

Browse files
committed
Update styling
1 parent 5d0d6f5 commit 35d7d82

File tree

1 file changed

+61
-35
lines changed

1 file changed

+61
-35
lines changed

app.R

Lines changed: 61 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,37 @@ ui <- fluidPage(
99
),
1010
tags$style(HTML("
1111
/* ---- Base ---- */
12+
html {
13+
font-size: 16px;
14+
}
1215
body {
1316
font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
17+
font-size: 1rem;
1418
color: #444;
1519
background-color: #f0f5f9;
1620
-webkit-font-smoothing: antialiased;
1721
-moz-osx-font-smoothing: grayscale;
1822
}
1923
.container-fluid {
20-
max-width: 1100px;
24+
max-width: 1200px;
2125
padding: 0 2rem;
2226
}
2327
2428
/* ---- Header banner ---- */
2529
.app-header {
2630
background: linear-gradient(135deg, #3a6f99, #4682B4);
2731
color: #ffffff;
28-
padding: 1.6rem 2rem;
32+
padding: 2rem 2.5rem;
2933
margin: -15px -15px 1.5rem -15px;
3034
border-radius: 0 0 8px 8px;
3135
}
3236
.app-header h2 {
3337
font-weight: 700;
34-
font-size: 1.6rem;
35-
margin: 0 0 0.3rem 0;
38+
font-size: 2rem;
39+
margin: 0 0 0.4rem 0;
3640
}
3741
.app-header p {
38-
font-size: 1.0rem;
42+
font-size: 1.15rem;
3943
margin: 0;
4044
opacity: 0.9;
4145
}
@@ -45,29 +49,29 @@ ui <- fluidPage(
4549
background: #ffffff;
4650
border: 1px solid #dee2e6;
4751
border-radius: 8px;
48-
padding: 1.25rem;
52+
padding: 1.5rem;
4953
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
5054
margin-bottom: 1.25rem;
5155
}
5256
.card h4 {
5357
font-weight: 600;
54-
font-size: 1.05rem;
58+
font-size: 1.25rem;
5559
color: #1a6b54;
5660
margin-top: 0;
5761
margin-bottom: 0.75rem;
5862
padding-bottom: 0.5rem;
5963
border-bottom: 2px solid #e8eef3;
6064
}
6165
.card p, .card li {
62-
font-size: 0.95rem;
63-
line-height: 1.6;
66+
font-size: 1.05rem;
67+
line-height: 1.65;
6468
color: #555;
6569
}
6670
.card ol {
67-
padding-left: 1.2rem;
71+
padding-left: 1.4rem;
6872
}
6973
.card ol li {
70-
padding: 0.2rem 0;
74+
padding: 0.25rem 0;
7175
}
7276
.card strong {
7377
color: #1a6b54;
@@ -79,12 +83,13 @@ ui <- fluidPage(
7983
border: 1px solid #dee2e6 !important;
8084
border-radius: 8px !important;
8185
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
82-
padding: 1.25rem !important;
86+
padding: 1.5rem !important;
8387
}
8488
.control-label {
8589
font-weight: 600;
86-
font-size: 0.9rem;
90+
font-size: 1.0rem;
8791
color: #3a6f99;
92+
margin-bottom: 0.25rem;
8893
}
8994
.irs--shiny .irs-bar {
9095
background: #4682B4;
@@ -100,7 +105,7 @@ ui <- fluidPage(
100105
border: 1px solid #4682B4;
101106
}
102107
.radio label {
103-
font-size: 0.9rem;
108+
font-size: 1.0rem;
104109
color: #555;
105110
}
106111
@@ -119,24 +124,24 @@ ui <- fluidPage(
119124
background: #ffffff;
120125
border: 1px solid #dee2e6;
121126
border-radius: 8px;
122-
padding: 1.25rem;
127+
padding: 1.5rem;
123128
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
124129
margin-bottom: 1.25rem;
125130
}
126131
.results-card .results-title {
127132
font-weight: 600;
128-
font-size: 1.05rem;
133+
font-size: 1.25rem;
129134
color: #1a6b54;
130135
margin-top: 0;
131136
margin-bottom: 0.75rem;
132137
padding-bottom: 0.5rem;
133138
border-bottom: 2px solid #e8eef3;
134139
}
135140
.results-card li {
136-
font-size: 0.93rem;
137-
line-height: 1.6;
141+
font-size: 1.05rem;
142+
line-height: 1.65;
138143
color: #555;
139-
padding: 0.3rem 0;
144+
padding: 0.4rem 0;
140145
border-bottom: 1px solid #f0f0f0;
141146
list-style: none;
142147
padding-left: 0.2rem;
@@ -153,7 +158,7 @@ ui <- fluidPage(
153158
.app-footer {
154159
text-align: center;
155160
color: #777;
156-
font-size: 0.85rem;
161+
font-size: 0.95rem;
157162
padding: 1rem 0 1.5rem 0;
158163
}
159164
.app-footer a {
@@ -209,7 +214,7 @@ ui <- fluidPage(
209214
# ---- Simulation ----
210215
sidebarLayout(
211216
sidebarPanel(width = 3,
212-
tags$h4(style = "font-weight: 600; font-size: 1.05rem; color: #1a6b54;
217+
tags$h4(style = "font-weight: 600; font-size: 1.25rem; color: #1a6b54;
213218
margin-top: 0; margin-bottom: 0.75rem; padding-bottom: 0.5rem;
214219
border-bottom: 2px solid #e8eef3;",
215220
"Parameters"),
@@ -339,22 +344,43 @@ server <- function(input, output) {
339344

340345
all_durs <- durs()
341346
extant_durs <- durs()[rels_obs()]
342-
fixed_xlim <- if (input$DistInput == "All equal")
343-
c(0, 2 * input$ExpectedDurationInput) else NULL
344347

345-
hist(all_durs, xlab = "Duration", ylab = "# Relationships",
346-
main = "Distribution of All Relational Durations",
347-
col = col_steelblue, border = "#ffffff",
348-
col.main = col_teal, font.main = 2, cex.main = 1.1,
349-
col.lab = "#555", col.axis = "#777",
350-
xlim = fixed_xlim)
348+
# Guard: if no extant ties, we can't histogram them
349+
req(length(extant_durs) > 0)
350+
351+
# For "All equal", all values are identical so hist() needs explicit
352+
# breaks and xlim to avoid a zero-width range error
353+
if (input$DistInput == "All equal") {
354+
eq_val <- input$ExpectedDurationInput
355+
eq_xlim <- c(0, 2 * eq_val)
356+
eq_breaks <- seq(0, 2 * eq_val, length.out = 30)
357+
358+
hist(all_durs, xlab = "Duration", ylab = "# Relationships",
359+
main = "Distribution of All Relational Durations",
360+
col = col_steelblue, border = "#ffffff",
361+
col.main = col_teal, font.main = 2, cex.main = 1.1,
362+
col.lab = "#555", col.axis = "#777",
363+
xlim = eq_xlim, breaks = eq_breaks)
364+
365+
hist(extant_durs, xlab = "Duration", ylab = "# Relationships",
366+
main = "Distribution of Durations for Extant Relations on Observation Day",
367+
col = "#2e7d9c", border = "#ffffff",
368+
col.main = col_teal, font.main = 2, cex.main = 1.1,
369+
col.lab = "#555", col.axis = "#777",
370+
xlim = eq_xlim, breaks = eq_breaks)
371+
} else {
372+
hist(all_durs, xlab = "Duration", ylab = "# Relationships",
373+
main = "Distribution of All Relational Durations",
374+
col = col_steelblue, border = "#ffffff",
375+
col.main = col_teal, font.main = 2, cex.main = 1.1,
376+
col.lab = "#555", col.axis = "#777")
351377

352-
hist(extant_durs, xlab = "Duration", ylab = "# Relationships",
353-
main = "Distribution of Durations for Extant Relations on Observation Day",
354-
col = "#2e7d9c", border = "#ffffff",
355-
col.main = col_teal, font.main = 2, cex.main = 1.1,
356-
col.lab = "#555", col.axis = "#777",
357-
xlim = fixed_xlim)
378+
hist(extant_durs, xlab = "Duration", ylab = "# Relationships",
379+
main = "Distribution of Durations for Extant Relations on Observation Day",
380+
col = "#2e7d9c", border = "#ffffff",
381+
col.main = col_teal, font.main = 2, cex.main = 1.1,
382+
col.lab = "#555", col.axis = "#777")
383+
}
358384
})
359385
}
360386

0 commit comments

Comments
 (0)