mirror of
https://ghproxy.net/https://github.com/abhijitb/helix.git
synced 2025-08-28 06:26:00 +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 [ activeTab, setActiveTab ] = useState( 'site' );
|
||||||
const [ notification, setNotification ] = useState( null );
|
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 handleSave = async () => {
|
||||||
const result = await saveSettings();
|
const result = await saveSettings();
|
||||||
|
|
||||||
|
@ -45,6 +55,9 @@ export default function Settings() {
|
||||||
'Failed to save settings. Please try again.',
|
'Failed to save settings. Please try again.',
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scroll to top to show the notification
|
||||||
|
scrollToTop();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
|
@ -53,6 +66,9 @@ export default function Settings() {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: 'Changes have been reset to their original values.',
|
message: 'Changes have been reset to their original values.',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Scroll to top to show the notification
|
||||||
|
scrollToTop();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTabChange = ( tabId ) => {
|
const handleTabChange = ( tabId ) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue