Skip to content

Commit cee4986

Browse files
authored
Merge pull request #154 from posit-dev/add-mega-example
Add nfl, Gini, and cars mega examples to examples page. This PR also removes an ununsed, hidden, set of examples in _raw.qmd.
2 parents ff0f535 + 2f071d0 commit cee4986

File tree

3 files changed

+350
-171
lines changed

3 files changed

+350
-171
lines changed

docs/examples/_raw.qmd

Lines changed: 0 additions & 154 deletions
This file was deleted.

docs/examples/index.qmd

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ h3 a {
1919
}
2020

2121
/* Turn off weird quarto whitespace behavior */
22-
.masonry-item > p {
22+
.masonry-item > p,
23+
.mega-example-item > p {
2324
margin: 0;
2425
padding: 0;
2526
position: absolute;
@@ -29,14 +30,21 @@ h3 a {
2930
bottom: 0;
3031
}
3132

33+
.mega-example-container {
34+
display: grid;
35+
grid-template-columns: repeat(3, 1fr);
36+
gap: 1em;
37+
}
38+
3239
.masonry-container {
3340
column-count: auto;
3441
/* Effectively determines number of columns (wider = fewer cols) */
3542
column-width: 11rem;
3643
column-gap: 1em;
3744
}
3845

39-
.masonry-item {
46+
.masonry-item,
47+
.mega-example-item {
4048
display: inline-block;
4149
width: 100%;
4250
margin-bottom: 1em;
@@ -64,14 +72,24 @@ h3 a {
6472
font-size: 1em;
6573
}
6674

67-
.masonry-item:hover .embed-hover-overlay {
68-
opacity: 1;
69-
pointer-events: auto;
75+
.masonry-item:hover .embed-hover-overlay,
76+
.mega-example-item:hover .embed-hover-overlay {
77+
opacity: 1;
78+
pointer-events: auto;
7079
}
7180

7281
.masonry-item .cell-output table {
7382
zoom: calc(260/var(--width) * var(--dynamic-factor));
7483
}
84+
85+
.mega-example-item .cell-output table {
86+
zoom: calc( 1 / 2600 * var(--mega-container-width));
87+
}
88+
89+
.mega-example-item .cell-output #mycombinedtable {
90+
zoom: 0.47;
91+
padding-top: 30px;
92+
}
7593
</style>
7694

7795
<script>
@@ -83,6 +101,13 @@ function updateZoom() {
83101
const factor = Math.max(0.3, Math.min(2.5, width / 300));
84102

85103
document.documentElement.style.setProperty('--dynamic-factor', factor);
104+
105+
// similar, but for mega examples
106+
const mega_example_container = document.querySelector('.mega-example-container');
107+
if (!mega_example_container) return;
108+
109+
const mega_example_width = mega_example_container.offsetWidth;
110+
document.documentElement.style.setProperty('--mega-container-width', mega_example_width);
86111
}
87112

88113
addEventListener('DOMContentLoaded', updateZoom);
@@ -111,14 +136,24 @@ addEventListener('DOMContentLoaded', setTableWidths);
111136
addEventListener('resize', setTableWidths);
112137
</script>
113138

114-
<!-- ::::: {.grid}
139+
::::{.mega-example-container}
140+
141+
:::{.mega-example-item style="--width: 724;"}
142+
{{< embed with-code.qmd#cars_table >}}
143+
[Cars](./with-code.html#cars_table){.embed-hover-overlay}
144+
:::
145+
146+
:::{.mega-example-item style="--width: 763;"}
147+
{{< embed with-code.qmd#nfl_table >}}
148+
[NFL 2011 Season](./with-code.html#nfl_table){.embed-hover-overlay}
149+
:::
115150

116-
:::{.g-col-lg-5 .g-col-12 .example .shrink-example}
117-
### [Two Column Layout](./before-after.qmd#two-column-layout)
118-
{{< embed _raw.qmd#two-column-layout >}}
151+
:::{.mega-example-item style="--width: 756;"}
152+
{{< embed with-code.qmd#gini_coefficient_table >}}
153+
[Gini Coefficients](./with-code.html#gini_coefficient_table){.embed-hover-overlay}
119154
:::
120155

121-
::::: -->
156+
::::
122157

123158
::::{.masonry-container}
124159

0 commit comments

Comments
 (0)