mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
fix lag when changing tabs on extension settings
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useRef, useEffect } from 'react';
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import type { TabbedContainerProps } from '../types/TabbedContainerProps';
|
import type { TabbedContainerProps } from '../types/TabbedContainerProps';
|
||||||
import { useSettingsContext } from '../SettingsContext';
|
import { useSettingsContext } from '../SettingsContext';
|
||||||
|
|
||||||
@@ -94,23 +94,19 @@ const TabbedContainer: React.FC<TabbedContainerProps> = ({ tabs }) => {
|
|||||||
transition={springTransition}
|
transition={springTransition}
|
||||||
>
|
>
|
||||||
<div className="absolute flex w-full" style={{ left: `${-position}%` }}>
|
<div className="absolute flex w-full" style={{ left: `${-position}%` }}>
|
||||||
<AnimatePresence>
|
{tabs.map((tab, index) => (
|
||||||
{tabs.map((tab, index) => (
|
<motion.div
|
||||||
activeTab === index && (
|
key={index}
|
||||||
<motion.div
|
className="absolute w-full pb-4"
|
||||||
key={index}
|
initial="hidden"
|
||||||
className="absolute w-full pb-4"
|
animate={activeTab === index ? "visible" : "hidden"}
|
||||||
initial="hidden"
|
transition={fastOpacityTransition}
|
||||||
animate="visible"
|
variants={contentVariants}
|
||||||
exit="hidden"
|
style={{ display: activeTab === index ? 'block' : 'none' }} // Hide inactive tabs using CSS
|
||||||
transition={fastOpacityTransition}
|
>
|
||||||
variants={contentVariants}
|
{tab.content}
|
||||||
>
|
</motion.div>
|
||||||
{tab.content}
|
))}
|
||||||
</motion.div>
|
|
||||||
)
|
|
||||||
))}
|
|
||||||
</AnimatePresence>
|
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user