Skip to content

Commit c7dc00b

Browse files
committed
chore: add skeleton component as a placeholder for loading language selector
1 parent e34cb26 commit c7dc00b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/components/Layout/LanguageSelector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { LanguageKey } from 'src/data/languages/types';
1212
import { useLayoutContext } from 'src/contexts/layout-context';
1313
import { navigate } from '../Link';
1414
import { LANGUAGE_SELECTOR_HEIGHT, INKEEP_ASK_BUTTON_HEIGHT } from './utils/heights';
15+
import { Skeleton } from '../ui/Skeleton';
1516

1617
type LanguageSelectorOptionData = {
1718
label: LanguageKey;
@@ -60,7 +61,7 @@ export const LanguageSelector = () => {
6061
};
6162

6263
if (!selectedOption) {
63-
return null;
64+
return <Skeleton className="w-[180px] h-5 my-[9px]" />;
6465
}
6566

6667
const selectedLang = languageInfo[selectedOption.label];

src/components/ui/Skeleton.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import cn from '@ably/ui/core/utils/cn';
2+
3+
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
4+
return (
5+
<div
6+
data-slot="skeleton"
7+
className={cn('bg-neutral-200 dark:bg-neutral-1100 animate-pulse rounded-md', className)}
8+
{...props}
9+
/>
10+
);
11+
}
12+
13+
export { Skeleton };

0 commit comments

Comments
 (0)