Skip to content

Commit fef1932

Browse files
authored
chore: reduce Searchbox button layout shift (#7358)
1 parent 4b710a9 commit fef1932

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

apps/site/components/Common/Search/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import tailwindConfig from '@/tailwind.config';
22

33
const colors = tailwindConfig.theme.colors;
44
export const themeConfig = {
5+
typography: {
6+
'--font-primary': 'var(--font-open-sans)',
7+
},
58
colors: {
69
light: {
710
'--text-color-primary': colors.neutral[900],

apps/site/components/Common/Skeleton/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import classNames from 'classnames';
12
import type { FC, PropsWithChildren } from 'react';
23
import { isValidElement } from 'react';
34

45
import styles from './index.module.css';
56

6-
type SkeletonProps = { hide?: boolean; loading?: boolean };
7+
type SkeletonProps = { hide?: boolean; loading?: boolean; className?: string };
78

89
const Skeleton: FC<PropsWithChildren<SkeletonProps>> = ({
910
children,
11+
className,
1012
hide = false,
1113
loading = true,
1214
}) => {
@@ -26,7 +28,7 @@ const Skeleton: FC<PropsWithChildren<SkeletonProps>> = ({
2628
<span
2729
tabIndex={-1}
2830
aria-hidden="true"
29-
className={styles.skeleton}
31+
className={classNames(styles.skeleton, className)}
3032
data-inline-skeleton={isValidElement(children) ? undefined : true}
3133
>
3234
{children}

apps/site/components/Containers/NavBar/index.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@
8686
dark:border-neutral-900;
8787
}
8888

89+
span.searchButtonSkeleton {
90+
@apply my-px
91+
mr-2
92+
flex-grow
93+
rounded-xl;
94+
95+
&:empty {
96+
@apply h-10;
97+
}
98+
}
99+
89100
.ghIconWrapper {
90101
@apply size-9
91102
rounded-md

apps/site/components/Containers/NavBar/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useState } from 'react';
88
import type { FC, ComponentProps, HTMLAttributeAnchorTarget } from 'react';
99

1010
import LanguageDropdown from '@/components/Common/LanguageDropDown';
11+
import Skeleton from '@/components/Common/Skeleton';
1112
import ThemeToggle from '@/components/Common/ThemeToggle';
1213
import NavItem from '@/components/Containers/NavBar/NavItem';
1314
import GitHub from '@/components/Icons/Social/GitHub';
@@ -19,6 +20,9 @@ import style from './index.module.css';
1920

2021
const SearchButton = dynamic(() => import('@/components/Common/Search'), {
2122
ssr: false,
23+
loading: () => (
24+
<Skeleton className={style.searchButtonSkeleton} loading={true} />
25+
),
2226
});
2327

2428
const navInteractionIcons = {

0 commit comments

Comments
 (0)