Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7810621

Browse files
committed
scroll to top on new level
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent91eae34 commit7810621

File tree

1 file changed

+5
-6
lines changed
  • web-app/src/containers/Tutorial/components

1 file changed

+5
-6
lines changed

‎web-app/src/containers/Tutorial/components/Level.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,22 @@ type Props = {
3939
}
4040

4141
constLevel=({ level}:Props)=>{
42-
constpageBottomRef=React.useRef(null)
43-
constscrollToBottom=()=>{
42+
constpageTopRef=React.useRef(null)
43+
constscrollToTop=()=>{
4444
//@ts-ignore
45-
pageBottomRef.current.scrollIntoView({behavior:'smooth'})
45+
pageTopRef.current.scrollIntoView({behavior:'smooth'})
4646
}
47-
React.useEffect(scrollToBottom,[level.id])
47+
React.useEffect(scrollToTop,[level.id])
4848

4949
return(
5050
<divcss={styles.page}>
51+
<divref={pageTopRef}/>
5152
<divcss={styles.content}>
5253
<Contenttitle={level.title}content={level.content}/>
5354

5455
{level.content.length&&level.steps.length ?<divcss={styles.separator}/> :null}
5556

5657
<Stepssteps={level.steps}/>
57-
58-
<divref={pageBottomRef}/>
5958
</div>
6059
</div>
6160
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp