theme/layouts: add two-cols-top layout - #35
Open
m-iwanicki wants to merge 2 commits into
Open
Conversation
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>
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>
Contributor
Author
$ ./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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
New layout: