Skip to content

closes #118. Scroll to bottom on save #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions web-app/src/containers/Tutorial/LevelPage/Level.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,15 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro
throw new Error('No Stage steps found')
}

const pageBottomRef = React.useRef(null)

const scrollToBottom = () => {
// @ts-ignore
pageBottomRef.current.scrollIntoView({ behavior: 'smooth' })
}
// @ts-ignore
const currentStep = level.steps.findIndex(s => s.status === 'ACTIVE')
React.useEffect(scrollToBottom, [currentStep])

return (
<div css={styles.page}>
Expand Down Expand Up @@ -113,6 +120,7 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro
)
})}
</div>
<div ref={pageBottomRef} />
</div>

{(testStatus || processes.length > 0) && (
Expand Down