Skip to content

Commit a44cd41

Browse files
committed
fix: pass ref
1 parent fe7c163 commit a44cd41

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

apps/site/components/Common/AvatarGroup/Avatar/index.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import Image from 'next/image';
3-
import type { FC, HTMLAttributes } from 'react';
3+
import type { HTMLAttributes } from 'react';
4+
import { forwardRef } from 'react';
45

56
import Link from '@/components/Link';
67

@@ -15,20 +16,16 @@ export type AvatarProps = {
1516
url?: string;
1617
};
1718

18-
const Avatar: FC<HTMLAttributes<HTMLSpanElement> & AvatarProps> = ({
19-
image,
20-
nickname,
21-
name,
22-
fallback,
23-
url,
24-
size = 'small',
25-
...props
26-
}) => {
19+
const Avatar = forwardRef<
20+
HTMLSpanElement,
21+
HTMLAttributes<HTMLSpanElement> & AvatarProps
22+
>(({ image, nickname, name, fallback, url, size = 'small', ...props }, ref) => {
2723
const Wrapper = url ? Link : 'div';
2824

2925
return (
3026
<span
3127
{...props}
28+
ref={ref}
3229
className={classNames(styles.avatar, styles[size], props.className)}
3330
>
3431
<Wrapper
@@ -56,6 +53,6 @@ const Avatar: FC<HTMLAttributes<HTMLSpanElement> & AvatarProps> = ({
5653
</Wrapper>
5754
</span>
5855
);
59-
};
56+
});
6057

6158
export default Avatar;

apps/site/providers/__tests__/matterProvider.test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const mockContext = {
88
headings: [],
99
readingTime: { text: '', minutes: 0, time: 0, words: 0 },
1010
filename: '',
11+
os: 'OTHER',
12+
architecture: 'x64',
13+
bitness: 64,
1114
};
1215

1316
describe('MatterProvider', () => {

apps/site/util/__tests__/assignClientContext.test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const mockContext = {
1111
words: 200,
1212
},
1313
filename: 'sample-file.md',
14+
os: 'OTHER',
15+
architecture: 'x64',
16+
bitness: 64,
1417
};
1518

1619
describe('assignClientContext', () => {

0 commit comments

Comments
 (0)