Skip to content

Commit 50ee32c

Browse files
Preserve title slide accents
Amp-Thread-ID: https://ampcode.com/threads/T-01a0449e-4249-720c-b618-ef3d17bd26ad Co-authored-by: Amp <amp@ampcode.com>
1 parent 0196a12 commit 50ee32c

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

engine/app/assets/stylesheets/coplan/deck.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@
241241
.deck-slide--title .deck-content h1,
242242
.deck-slide--title .deck-content h2,
243243
.deck-slide--title .deck-content h3 {
244+
display: grid;
245+
grid-template-columns: minmax(0, auto) auto;
246+
align-items: center;
247+
justify-content: start;
244248
font-size: 2.8em;
245249
line-height: 1.1;
246250
letter-spacing: -0.02em;
@@ -256,6 +260,7 @@
256260
display: block;
257261
width: 1.6em;
258262
height: 0.16em;
263+
grid-column: 1 / -1;
259264
border-radius: 0.08em;
260265
background: var(--deck-title-accent, var(--deck-accent));
261266
margin-bottom: 0.55em;

spec/system/deck_ux_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,28 @@ def attachments_on_screen?
118118
JS
119119
end
120120

121+
it "keeps the title-slide accent above its aligned section shortcut" do
122+
visit plan_page_path(plan)
123+
expect(page).to have_css(".deck-slide--title .section-permalink", visible: :all)
124+
125+
layout = page.evaluate_script(<<~JS)
126+
(() => {
127+
const heading = document.querySelector(".deck-slide--title .section-heading")
128+
const title = heading.querySelector(".section-heading__title").getBoundingClientRect()
129+
const link = heading.querySelector(".section-permalink").getBoundingClientRect()
130+
const accent = getComputedStyle(heading, "::before")
131+
return {
132+
display: getComputedStyle(heading).display,
133+
accentColumn: `${accent.gridColumnStart} / ${accent.gridColumnEnd}`,
134+
centerDelta: Math.abs((title.top + title.bottom - link.top - link.bottom) / 2)
135+
}
136+
})()
137+
JS
138+
139+
expect(layout).to include("display" => "grid", "accentColumn" => "1 / -1")
140+
expect(layout["centerDelta"]).to be < 1
141+
end
142+
121143
describe "present mode" do
122144
it "treats a drag as a highlight and a bare click as the next slide" do
123145
visit plan_page_path(plan)

0 commit comments

Comments
 (0)