mirror of
https://ghproxy.net/https://github.com/abhijitb/helix.git
synced 2025-08-27 20:13:02 +08:00
scroll to top on save or reset
This commit is contained in:
parent
fc331c2e7c
commit
c5a983d24b
3 changed files with 24 additions and 7 deletions
1
build/assets/App-CmzsIsBk.css
Normal file
1
build/assets/App-CmzsIsBk.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -29,6 +29,16 @@ export default function Settings() {
|
|||
const [ activeTab, setActiveTab ] = useState( 'site' );
|
||||
const [ notification, setNotification ] = useState( null );
|
||||
|
||||
/**
|
||||
* Smoothly scroll to the top of the page
|
||||
*/
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo( {
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
} );
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
const result = await saveSettings();
|
||||
|
||||
|
@ -45,6 +55,9 @@ export default function Settings() {
|
|||
'Failed to save settings. Please try again.',
|
||||
} );
|
||||
}
|
||||
|
||||
// Scroll to top to show the notification
|
||||
scrollToTop();
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
|
@ -53,6 +66,9 @@ export default function Settings() {
|
|||
type: 'info',
|
||||
message: 'Changes have been reset to their original values.',
|
||||
} );
|
||||
|
||||
// Scroll to top to show the notification
|
||||
scrollToTop();
|
||||
};
|
||||
|
||||
const handleTabChange = ( tabId ) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue