Skip to content

Commit

Permalink
remove const
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Jan 30, 2024
1 parent fe519e8 commit 8ec48ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
6 changes: 1 addition & 5 deletions website/src/components/detailsToggle/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import styles from './styles.module.css';

function detailsToggle({ children, alt_header = null }) {
const [isOn, setOn] = useState(false);
const [hoverTimeout, setHoverTimeout] = useState(null);

const handleToggleClick = () => {
setOn(current => !current);
};

useEffect(() => {
return () => clearTimeout(hoverTimeout);
}, [hoverTimeout]);

return (
<div className='detailsToggle'>
Expand Down
17 changes: 2 additions & 15 deletions website/src/components/faqs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function FAQ({ path, alt_header = null }) {
const [isOn, setOn] = useState(false);
const [filePath, setFilePath] = useState(path);
const [fileContent, setFileContent] = useState({});
const [hoverTimeout, setHoverTimeout] = useState(null);

// Get all faq file paths from plugin
const { faqFiles } = usePluginData('docusaurus-build-global-data-plugin');
Expand Down Expand Up @@ -37,21 +36,9 @@ function FAQ({ path, alt_header = null }) {
}
}, [filePath])


useEffect(() => {
return () => {
if (hoverTimeout) {
clearTimeout(hoverTimeout);
}
};
}, [hoverTimeout]);

const toggleOn = () => {
if (hoverTimeout) {
clearTimeout(hoverTimeout);
}
const toggleOn = function () {
setOn(!isOn);
};
}

return (
<div className={styles.faqs}>
Expand Down

0 comments on commit 8ec48ed

Please sign in to comment.