Skip to content

Commit

Permalink
Merge pull request #268 from code-hike/transition-scrollbars
Browse files Browse the repository at this point in the history
Fix focus height on transitions
  • Loading branch information
pomber authored Aug 13, 2022
2 parents c0836c7 + e535588 commit d5658fc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/mdx/src/smooth-code/splitter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@ export function splitByFocus(
>
): FocusedCode {
const { lines, ...mergedCodeRest } = mergedCode
const focusByLineNumber = map(focus, focus =>
mapFocusToLineNumbers(focus, lines)
)

const focusByLineNumber = map(focus, (focus, key) => {
// we need to filter the lines that don't belong to the step
// for the case where focus == ""
const stepLines =
key === "prev"
? lines.filter(l => l.move !== "enter")
: lines.filter(l => l.move !== "exit")

return mapFocusToLineNumbers(focus, stepLines)
})

const splittedLines = lines.map(line => {
const { tokens, ...rest } = line
Expand Down

0 comments on commit d5658fc

Please sign in to comment.