Skip to content

Commit 899a997

Browse files
committed
Chore: Merge main into accessibility-fix
2 parents b0ac9ea + 0d0a4a4 commit 899a997

File tree

19 files changed

+456
-223
lines changed

19 files changed

+456
-223
lines changed

.github/workflows/create-release-post.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535

3636
- run: node --run scripts:release-post -- "$VERSION"
3737
working-directory: apps/site
38+
id: release-post
3839
env:
3940
VERSION: ${{ inputs.version }}
4041

@@ -54,4 +55,5 @@ jobs:
5455
commit-message: 'feat(blog): create post for ${{ inputs.version }}'
5556
labels: fast-track
5657
title: 'feat(blog): create post for ${{ inputs.version }}'
58+
assignees: ${{ steps.release-post.outputs.author }}
5759
draft: true
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
'use client';
22

3+
import styles from '@node-core/ui-components/Common/Search/Results/Hit/index.module.css';
34
import Link from 'next/link';
45
import { useLocale } from 'next-intl';
56

67
import type { FC } from 'react';
78

8-
import styles from './index.module.css';
9+
import { getDocumentHref } from '../SearchItem/utils';
910

1011
export type Document = {
1112
path: string;
@@ -22,30 +23,21 @@ type DocumentLinkProps = {
2223

2324
export const DocumentLink: FC<DocumentLinkProps> = ({
2425
document,
25-
className = styles.documentLink,
26+
className = styles.link,
2627
children,
2728
'data-focus-on-arrow-nav': dataFocusOnArrowNav,
2829
...props
2930
}) => {
3031
const locale = useLocale();
3132

32-
const href =
33-
document.siteSection?.toLowerCase() === 'docs'
34-
? `/${document.path}`
35-
: `/${locale}/${document.path}`;
36-
3733
return (
3834
<Link
39-
href={href}
35+
href={getDocumentHref(document, locale)}
4036
className={className}
4137
data-focus-on-arrow-nav={dataFocusOnArrowNav}
4238
{...props}
4339
>
44-
{children || (
45-
<span className={styles.documentTitle}>
46-
{document.pageSectionTitle}
47-
</span>
48-
)}
40+
{children}
4941
</Link>
5042
);
5143
};

apps/site/components/Common/Searchbox/SearchItem/index.module.css

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,36 @@
1-
'use client';
2-
3-
import { DocumentTextIcon } from '@heroicons/react/24/outline';
4-
import { SearchResults } from '@orama/ui/components';
1+
import SearchHit from '@node-core/ui-components/Common/Search/Results/Hit';
2+
import Link from 'next/link';
3+
import { useLocale } from 'next-intl';
54

65
import type { Document } from '../DocumentLink';
7-
import type { FC } from 'react';
8-
9-
import { DocumentLink } from '../DocumentLink';
10-
import { getFormattedPath } from './utils';
6+
import type { LinkLike } from '@node-core/ui-components/types';
7+
import type { ComponentProps, FC } from 'react';
118

12-
import styles from './index.module.css';
9+
import { getDocumentHref, getFormattedPath } from './utils';
1310

14-
type SearchItemProps = {
11+
type SearchItemProps = Omit<
12+
ComponentProps<typeof SearchHit>,
13+
'document' | 'as'
14+
> & {
1515
document: Document;
16-
mode?: 'search' | 'chat';
1716
};
1817

19-
export const SearchItem: FC<SearchItemProps> = ({ document, mode }) => (
20-
<SearchResults.Item className={styles.searchResultsItem}>
21-
<DocumentLink
22-
document={document as Document}
23-
tabIndex={mode === 'search' ? 0 : -1}
24-
aria-hidden={mode === 'chat'}
25-
data-focus-on-arrow-nav
26-
>
27-
<DocumentTextIcon />
28-
<div>
29-
{typeof document?.pageSectionTitle === 'string' && (
30-
<h3>{document.pageSectionTitle}</h3>
31-
)}
32-
{typeof document?.pageSectionTitle === 'string' &&
33-
typeof document?.path === 'string' && (
34-
<p className={styles.searchResultsItemDescription}>
35-
{getFormattedPath(document.path, document.pageSectionTitle)}
36-
</p>
37-
)}
38-
</div>
39-
</DocumentLink>
40-
</SearchResults.Item>
41-
);
18+
const SearchItem: FC<SearchItemProps> = ({ document, ...props }) => {
19+
const locale = useLocale();
20+
21+
return (
22+
<SearchHit
23+
document={{
24+
title: document.pageSectionTitle,
25+
description:
26+
document.pageSectionTitle &&
27+
getFormattedPath(document.path, document.pageSectionTitle),
28+
href: getDocumentHref(document, locale),
29+
}}
30+
as={Link as LinkLike}
31+
{...props}
32+
/>
33+
);
34+
};
35+
36+
export default SearchItem;

apps/site/components/Common/Searchbox/SearchItem/utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { Document } from '../DocumentLink';
2+
13
export const uppercaseFirst = (word: string) =>
24
word.charAt(0).toUpperCase() + word.slice(1);
35

@@ -9,3 +11,8 @@ export const getFormattedPath = (path: string, title: string) =>
911
.map(element => uppercaseFirst(element))
1012
.filter(Boolean)
1113
.join(' > ')}${title}`;
14+
15+
export const getDocumentHref = (document: Document, locale: string) =>
16+
document.siteSection?.toLowerCase() === 'docs'
17+
? `/${document.path}`
18+
: `/${locale}/${document.path}`;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { FC } from 'react';
1414

1515
import { Footer } from './Footer';
1616
import { oramaClient } from './orama-client';
17-
import { SearchItem } from './SearchItem';
17+
import SearchItem from './SearchItem';
1818
import { SlidingChatPanel } from './SlidingChatPanel';
1919

2020
import styles from './index.module.css';

apps/site/eslint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import next from '@next/eslint-plugin-next';
22
import * as mdx from 'eslint-plugin-mdx';
33
import react from 'eslint-plugin-react';
4-
import * as hooks from 'eslint-plugin-react-hooks';
4+
import reactHooks from 'eslint-plugin-react-hooks';
55

66
import baseConfig from '../../eslint.config.js';
77

@@ -11,7 +11,7 @@ export default baseConfig.concat([
1111
},
1212

1313
react.configs.flat['jsx-runtime'],
14-
hooks.configs['recommended-latest'],
14+
reactHooks.configs.flat['recommended-latest'],
1515
next.configs['core-web-vitals'],
1616
mdx.flatCodeBlocks,
1717

apps/site/hooks/react-client/useMediaQuery.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@
33
import { useState, useEffect } from 'react';
44

55
const useMediaQuery = (query: string) => {
6-
const [matches, setMatches] = useState(false);
6+
const [matches, setMatches] = useState(() => {
7+
if (typeof window === 'undefined') {
8+
return false;
9+
}
10+
11+
return window.matchMedia?.(query)?.matches ?? false;
12+
});
713

814
useEffect(() => {
9-
const { matches, addEventListener, removeEventListener } =
10-
window.matchMedia?.(query) ?? {
11-
matches: false,
12-
addEventListener: () => {},
13-
removeEventListener: () => {},
14-
};
15-
16-
setMatches(matches);
15+
const { addEventListener, removeEventListener } = window.matchMedia?.(
16+
query
17+
) ?? {
18+
matches: false,
19+
addEventListener: () => {},
20+
removeEventListener: () => {},
21+
};
1722

1823
const handler = (event: MediaQueryListEvent) => setMatches(event.matches);
1924

apps/site/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"@opentelemetry/api-logs": "~0.206.0",
4242
"@opentelemetry/instrumentation": "~0.206.0",
4343
"@opentelemetry/resources": "~1.30.1",
44-
"@orama/core": "^1.2.13",
45-
"@orama/ui": "^1.5.3",
4644
"@opentelemetry/sdk-logs": "~0.206.0",
45+
"@orama/core": "^1.2.14",
46+
"@orama/ui": "^1.5.3",
4747
"@radix-ui/react-tabs": "^1.1.13",
4848
"@radix-ui/react-tooltip": "^1.2.8",
4949
"@tailwindcss/postcss": "~4.1.17",
@@ -59,7 +59,7 @@
5959
"github-slugger": "~2.0.0",
6060
"gray-matter": "~4.0.3",
6161
"mdast-util-to-string": "^4.0.0",
62-
"next": "16.0.7",
62+
"next": "16.0.10",
6363
"next-intl": "~4.5.3",
6464
"next-themes": "~0.4.6",
6565
"postcss-calc": "~10.1.1",
@@ -93,7 +93,7 @@
9393
"eslint-config-next": "16.0.7",
9494
"eslint-plugin-mdx": "~3.6.2",
9595
"eslint-plugin-react": "~7.37.5",
96-
"eslint-plugin-react-hooks": "^5.2.0",
96+
"eslint-plugin-react-hooks": "^7.0.1",
9797
"global-jsdom": "^27.0.0",
9898
"handlebars": "4.7.8",
9999
"jsdom": "^27.2.0",

0 commit comments

Comments
 (0)