Skip to content

theme/layouts: add two-cols-top layout - #35

Open
m-iwanicki wants to merge 2 commits into
slidev-conffrom
feature/two-cols-top-layout
Open

theme/layouts: add two-cols-top layout#35
m-iwanicki wants to merge 2 commits into
slidev-conffrom
feature/two-cols-top-layout

Conversation

@m-iwanicki

Copy link
Copy Markdown
Contributor

Like the built-in two-cols-header, but the header row is sized to its content (auto) instead of taking half the slide height, so the two columns start directly beneath the header rather than at the vertical middle. Add a column gutter so adjacent column content is separated.

Keeps the same slot API as two-cols-header: default slot is the header, ::left:: and ::right:: are the columns, ::bottom:: spans both columns pinned to the slide bottom.

Before (original layout):

Screenshot From 2026-07-01 15-47-23

New layout:

Screenshot From 2026-07-01 15-47-27

Like the built-in two-cols-header, but the header row is sized to its
content (auto) instead of taking half the slide height, so the two
columns start directly beneath the header rather than at the vertical
middle. Add a column gutter so adjacent column content is separated.

Keeps the same slot API as two-cols-header: default slot is the header,
::left:: and ::right:: are the columns, ::bottom:: spans both columns
pinned to the slide bottom.

Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
@m-iwanicki
m-iwanicki requested a review from macpijan July 1, 2026 13:52
@m-iwanicki m-iwanicki self-assigned this Jul 1, 2026
@pietrushnic

pietrushnic commented Sep 7, 2026

Copy link
Copy Markdown
Member

@m-iwanicki, it would be great to add tests so we do not regress this functionality: https://github.com/3mdeb/slidev-template/tree/main/tests

Please paste the test results as evidence that we are not regressing other functionality.

Add a two-cols-top slide as the last slide of the fixture deck, which
keeps every existing slide number in place, and assert the layout's grid
directly instead of relying on a screenshot alone. The assertions cover
slot routing into the header, both columns and the bottom row, columns
that start where the header ends, a gutter between columns of equal
width, and a bottom row spanning both columns at the slide bottom. Boxes
are compared against each other or against a fraction of the slide,
because Slidev scales the slide with a transform.

Pair the tests with a broken fixture that renders the same slide on the
built-in two-cols-header layout, which drops the two-cols-top class the
assertions key on, and wire it into run-tests.sh as the two-cols-top
fixture.

Run broken fixtures with --update-snapshots=none, so a missing baseline
fails the run rather than being written into the baseline directory from
a deliberately broken deck.

Accept an optional grep pattern for the update command, which generates
a single baseline without refreshing the others.

Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
@m-iwanicki

m-iwanicki commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

cce668b

$ ./scripts/run-tests.sh run-tests.sh

  27 passed (1.2m)
All tests passed!
Cleaning up...

$ ./scripts/run-tests.sh broken two-cols-top

✓ two-cols-top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants