Skip to content

Commit 0e052bc

Browse files
committed
fix: stop y axis animation on tab group
1 parent 5daa0ef commit 0e052bc

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Shared/Components/TabGroup/TabGroup.component.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ import { getClassNameBySizeMap, tabGroupClassMap } from './TabGroup.utils'
2828
import './TabGroup.scss'
2929

3030
const MotionLayoutUnderline = ({ layoutId }: { layoutId: string }) => (
31-
<motion.div layout="position" layoutId={layoutId} className="underline bcb-5" />
31+
<motion.div
32+
layout="position"
33+
transformTemplate={(_, generatedTransform) =>
34+
// Replace the y value in translate3d(x, y, z) with 0px to omit y axis transitions
35+
generatedTransform.replace(/translate3d\(([^,]+),\s*[^,]+,\s*([^)]+)\)/, 'translate3d($1, 0px, $2)')
36+
}
37+
layoutId={layoutId}
38+
className="underline bcb-5"
39+
/>
3240
)
3341

3442
const Tab = ({

src/Shared/Components/TabGroup/TabGroup.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@include svg-styles(var(--N700));
3535

3636
.underline {
37-
height: 2px;
37+
height: 2px !important;
3838
border-top-left-radius: 2px;
3939
border-top-right-radius: 2px;
4040
}

0 commit comments

Comments
 (0)