Skip to content

Commit 4d438ec

Browse files
author
Kubit
committed
Use thirdpartyAnimation as Span
1 parent 2cde896 commit 4d438ec

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/components/thirdPartyAnimation/thirdPartyAnimation.styled.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import styled from 'styled-components';
22

33
import { IThirdPartyAnimationStyled } from './types';
44

5-
export const ThirdPartyAnimationStyled = styled.div<IThirdPartyAnimationStyled>`
5+
export const ThirdPartyAnimationStyled = styled.span<IThirdPartyAnimationStyled>`
6+
display: block;
67
width: ${props => props.$width};
78
height: ${props => props.$height};
89
`;

src/components/thirdPartyAnimation/thirdPartyAnimation.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const THIRD_PARTY_ANIMATION_STYLES = 'THIRD_PARTY_ANIMATION_STYLES';
1111

1212
const ThirdPartyAnimationComponent = <V extends string | unknown>(
1313
{ autoplay = true, loop = true, variant, ...props }: IThirdPartyAnimation<V>,
14-
ref: React.ForwardedRef<HTMLDivElement | null>
14+
ref: React.ForwardedRef<HTMLSpanElement | null>
1515
): JSX.Element => {
1616
const [animation, setAnimation] = React.useState<AnimationItem>();
1717
const variantTheme = useStyles<{ thirdPartyAnimationData: object }, V>(
@@ -20,15 +20,11 @@ const ThirdPartyAnimationComponent = <V extends string | unknown>(
2020
);
2121

2222
const { thirdPartyAnimationData } = variantTheme;
23-
const element = React.useRef<HTMLDivElement>(null);
23+
const element = React.useRef<HTMLSpanElement>(null);
2424

25-
React.useImperativeHandle(
26-
ref,
27-
() => {
28-
return element.current as HTMLDivElement;
29-
},
30-
[]
31-
);
25+
React.useImperativeHandle(ref, () => {
26+
return element.current as HTMLSpanElement;
27+
}, []);
3228

3329
React.useEffect(() => {
3430
if (element.current) {
@@ -53,7 +49,7 @@ const ThirdPartyAnimationComponent = <V extends string | unknown>(
5349

5450
const ThirdPartyAnimation = React.forwardRef(ThirdPartyAnimationComponent) as <V>(
5551
props: React.PropsWithChildren<IThirdPartyAnimation<V>> & {
56-
ref?: React.ForwardedRef<HTMLDivElement | null> | undefined | null;
52+
ref?: React.ForwardedRef<HTMLSpanElement | null> | undefined | null;
5753
}
5854
) => ReturnType<typeof ThirdPartyAnimationComponent>;
5955

src/components/thirdPartyAnimation/thirdPartyAnimationStandAlone.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IThirdPartyAnimationStandAlone } from './types';
88

99
const ThirdPartyAnimationStandAloneComponent = (
1010
{ dataTestId, height, width, ...props }: IThirdPartyAnimationStandAlone,
11-
ref: React.ForwardedRef<HTMLDivElement | null>
11+
ref: React.ForwardedRef<HTMLSpanElement | null>
1212
): JSX.Element => {
1313
const emptyAriaLabel = props['aria-label'].length === 0;
1414

0 commit comments

Comments
 (0)