chore(deps): update lint dependency (#1120)
Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
This commit is contained in:
parent
25f8d82750
commit
10c5b2ea14
37 changed files with 1174 additions and 930 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"packages": ["packages/docsearch-*"],
|
||||
"node": "14"
|
||||
"node": "16"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable import/no-commonjs */
|
||||
module.exports = {
|
||||
extends: ['algolia', 'algolia/jest', 'algolia/react', 'algolia/typescript'],
|
||||
globals: {
|
||||
|
|
@ -45,6 +46,11 @@ module.exports = {
|
|||
pathGroupsExcludedImportTypes: ['builtin'],
|
||||
},
|
||||
],
|
||||
|
||||
// TMP
|
||||
'@typescript-eslint/explicit-function-return-type': ['off'],
|
||||
'react/function-component-definition': ['off'],
|
||||
'react/jsx-filename-extension': ['off'],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
context('Start', () => {
|
||||
describe('Start', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.config().baseUrl!);
|
||||
});
|
||||
|
|
@ -29,7 +29,7 @@ context('Start', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('End', () => {
|
||||
describe('End', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.config().baseUrl!);
|
||||
cy.get('.DocSearch-Button').click();
|
||||
|
|
@ -57,7 +57,7 @@ context('End', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('Search', () => {
|
||||
describe('Search', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.config().baseUrl!);
|
||||
cy.get('.DocSearch-Button').click();
|
||||
|
|
@ -97,7 +97,7 @@ context('Search', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('Recent and Favorites', () => {
|
||||
describe('Recent and Favorites', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.config().baseUrl!);
|
||||
cy.get('.DocSearch-Button').click();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable import/no-commonjs */
|
||||
const percyHealthCheck = require('@percy/cypress/task');
|
||||
|
||||
|
|
|
|||
10
cypress/support/commands.d.ts
vendored
10
cypress/support/commands.d.ts
vendored
|
|
@ -5,22 +5,22 @@ declare namespace Cypress {
|
|||
/**
|
||||
* Toggles the dark mode on the preview website.
|
||||
*/
|
||||
darkmode(): Chainable<Element>;
|
||||
darkmode: () => Chainable<Element>;
|
||||
/**
|
||||
* Opens the DocSearch modal.
|
||||
*/
|
||||
openModal(): Chainable<Element>;
|
||||
openModal: () => Chainable<Element>;
|
||||
/**
|
||||
* Closes the DocSearch modal.
|
||||
*/
|
||||
closeModal(): Chainable<Element>;
|
||||
closeModal: () => Chainable<Element>;
|
||||
/**
|
||||
* Types a query that returns results.
|
||||
*/
|
||||
typeQueryMatching(): Chainable<Element>;
|
||||
typeQueryMatching: () => Chainable<Element>;
|
||||
/**
|
||||
* Types a query that returns no results.
|
||||
*/
|
||||
typeQueryNotMatching(): Chainable<Element>;
|
||||
typeQueryNotMatching: () => Chainable<Element>;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
global.d.ts
vendored
1
global.d.ts
vendored
|
|
@ -1 +1,2 @@
|
|||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
declare const __DEV__: boolean;
|
||||
|
|
|
|||
40
package.json
40
package.json
|
|
@ -54,8 +54,8 @@
|
|||
"@types/jest-diff": "^24.3.0",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "2.19.0",
|
||||
"@typescript-eslint/parser": "2.19.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.2.0",
|
||||
"@typescript-eslint/parser": "5.2.0",
|
||||
"algoliasearch": "4.10.3",
|
||||
"babel-eslint": "10.1.0",
|
||||
"babel-loader": "8.1.0",
|
||||
|
|
@ -67,21 +67,23 @@
|
|||
"cssnano": "4.1.10",
|
||||
"cypress": "6.4.0",
|
||||
"dotenv": "8.2.0",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-algolia": "15.0.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-cypress": "2.11.1",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-algolia": "19.0.2",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-cypress": "2.12.1",
|
||||
"eslint-plugin-eslint-comments": "3.2.0",
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"eslint-plugin-jest": "23.20.0",
|
||||
"eslint-plugin-prettier": "3.1.4",
|
||||
"eslint-plugin-react": "7.20.6",
|
||||
"eslint-plugin-react-hooks": "2.3.0",
|
||||
"eslint-plugin-import": "2.25.2",
|
||||
"eslint-plugin-jest": "25.2.2",
|
||||
"eslint-plugin-jsdoc": "37.0.3",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-prettier": "4.0.0",
|
||||
"eslint-plugin-react": "7.26.1",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"jest": "26.4.2",
|
||||
"jest-watch-typeahead": "0.6.0",
|
||||
"lerna": "4.0.0",
|
||||
"postcss": "7.0.36",
|
||||
"prettier": "2.1.1",
|
||||
"prettier": "2.4.1",
|
||||
"react": "17.0.2",
|
||||
"react-dom": "17.0.2",
|
||||
"rollup": "1.31.0",
|
||||
|
|
@ -92,14 +94,14 @@
|
|||
"rollup-plugin-terser": "5.2.0",
|
||||
"shipjs": "0.23.0",
|
||||
"start-server-and-test": "1.11.3",
|
||||
"stylelint": "13.7.0",
|
||||
"stylelint": "14.0.1",
|
||||
"stylelint-a11y": "1.2.3",
|
||||
"stylelint-config-prettier": "8.0.2",
|
||||
"stylelint-config-sass-guidelines": "7.0.0",
|
||||
"stylelint-config-standard": "20.0.0",
|
||||
"stylelint-no-unsupported-browser-features": "4.0.0",
|
||||
"stylelint-order": "4.1.0",
|
||||
"stylelint-prettier": "1.1.2",
|
||||
"stylelint-config-prettier": "9.0.3",
|
||||
"stylelint-config-sass-guidelines": "9.0.0",
|
||||
"stylelint-config-standard": "23.0.0",
|
||||
"stylelint-no-unsupported-browser-features": "5.0.2",
|
||||
"stylelint-order": "5.0.0",
|
||||
"stylelint-prettier": "1.2.0",
|
||||
"typescript": "4.1.2",
|
||||
"watch": "1.0.2",
|
||||
"webpack": "4.44.1"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable import/no-commonjs, import/no-extraneous-dependencies */
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
|
|
@ -11,16 +12,16 @@ const pkg = require('./package.json');
|
|||
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
|
||||
function getBundleBanner(pkg) {
|
||||
function getBundleBanner(_pkg) {
|
||||
const lastCommitHash = execSync('git rev-parse --short HEAD')
|
||||
.toString()
|
||||
.trim();
|
||||
const version = process.env.SHIPJS
|
||||
? pkg.version
|
||||
: `${pkg.version} (UNRELEASED ${lastCommitHash})`;
|
||||
? _pkg.version
|
||||
: `${_pkg.version} (UNRELEASED ${lastCommitHash})`;
|
||||
const authors = '© Algolia, Inc. and contributors';
|
||||
|
||||
return `/*! ${pkg.name} ${version} | MIT License | ${authors} | ${pkg.homepage} */`;
|
||||
return `/*! ${_pkg.name} ${version} | MIT License | ${authors} | ${_pkg.homepage} */`;
|
||||
}
|
||||
|
||||
function build({ input, output, banner }) {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
import {
|
||||
DocSearch,
|
||||
DocSearchProps as DocSearchComponentProps,
|
||||
version,
|
||||
} from '@docsearch/react';
|
||||
import type { DocSearchProps as DocSearchComponentProps } from '@docsearch/react';
|
||||
import { DocSearch, version } from '@docsearch/react';
|
||||
import React, { render } from 'preact/compat';
|
||||
|
||||
function getHTMLElement(
|
||||
value: string | HTMLElement,
|
||||
value: HTMLElement | string,
|
||||
environment: DocSearchProps['environment'] = window
|
||||
): HTMLElement {
|
||||
if (typeof value === 'string') {
|
||||
|
|
@ -17,7 +14,7 @@ function getHTMLElement(
|
|||
}
|
||||
|
||||
interface DocSearchProps extends DocSearchComponentProps {
|
||||
container: string | HTMLElement;
|
||||
container: HTMLElement | string;
|
||||
environment?: typeof window;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
export function AlgoliaLogo() {
|
||||
export const AlgoliaLogo: React.FC = () => {
|
||||
return (
|
||||
<a
|
||||
href="https://www.algolia.com/docsearch"
|
||||
|
|
@ -17,4 +17,4 @@ export function AlgoliaLogo() {
|
|||
</svg>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import {
|
||||
import type {
|
||||
AutocompleteState,
|
||||
AutocompleteOptions,
|
||||
} from '@algolia/autocomplete-core';
|
||||
import { SearchClient } from 'algoliasearch/lite';
|
||||
import type { SearchClient } from 'algoliasearch/lite';
|
||||
import React from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
import { DocSearchButton } from './DocSearchButton';
|
||||
import { DocSearchModal } from './DocSearchModal';
|
||||
import {
|
||||
import type {
|
||||
DocSearchHit,
|
||||
InternalDocSearchHit,
|
||||
StoredDocSearchHit,
|
||||
|
|
@ -21,15 +21,15 @@ export interface DocSearchProps {
|
|||
indexName: string;
|
||||
placeholder?: string;
|
||||
searchParameters?: any;
|
||||
transformItems?(items: DocSearchHit[]): DocSearchHit[];
|
||||
hitComponent?(props: {
|
||||
transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
|
||||
hitComponent?: (props: {
|
||||
hit: InternalDocSearchHit | StoredDocSearchHit;
|
||||
children: React.ReactNode;
|
||||
}): JSX.Element;
|
||||
resultsFooterComponent?(props: {
|
||||
}) => JSX.Element;
|
||||
resultsFooterComponent?: (props: {
|
||||
state: AutocompleteState<InternalDocSearchHit>;
|
||||
}): JSX.Element | null;
|
||||
transformSearchClient?(searchClient: SearchClient): SearchClient;
|
||||
}) => JSX.Element | null;
|
||||
transformSearchClient?: (searchClient: SearchClient) => SearchClient;
|
||||
disableUserPersonalization?: boolean;
|
||||
initialQuery?: string;
|
||||
navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator'];
|
||||
|
|
@ -68,7 +68,7 @@ export function DocSearch(props: DocSearchProps) {
|
|||
|
||||
return (
|
||||
<>
|
||||
<DocSearchButton onClick={onOpen} ref={searchButtonRef} />
|
||||
<DocSearchButton ref={searchButtonRef} onClick={onOpen} />
|
||||
|
||||
{isOpen &&
|
||||
createPortal(
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
import {
|
||||
AutocompleteState,
|
||||
createAutocomplete,
|
||||
} from '@algolia/autocomplete-core';
|
||||
import type { AutocompleteState } from '@algolia/autocomplete-core';
|
||||
import { createAutocomplete } from '@algolia/autocomplete-core';
|
||||
import React from 'react';
|
||||
|
||||
import { MAX_QUERY_SIZE } from './constants';
|
||||
import { DocSearchProps } from './DocSearch';
|
||||
import type { DocSearchProps } from './DocSearch';
|
||||
import { Footer } from './Footer';
|
||||
import { Hit } from './Hit';
|
||||
import { ScreenState } from './ScreenState';
|
||||
import { SearchBox } from './SearchBox';
|
||||
import { createStoredSearches } from './stored-searches';
|
||||
import {
|
||||
import type {
|
||||
DocSearchHit,
|
||||
InternalDocSearchHit,
|
||||
StoredDocSearchHit,
|
||||
|
|
@ -23,7 +21,7 @@ import { groupBy, identity, noop, removeHighlightTags } from './utils';
|
|||
|
||||
export interface DocSearchModalProps extends DocSearchProps {
|
||||
initialScrollY: number;
|
||||
onClose?(): void;
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
export function DocSearchModal({
|
||||
|
|
@ -126,11 +124,11 @@ export function DocSearchModal({
|
|||
},
|
||||
},
|
||||
navigator,
|
||||
onStateChange({ state }) {
|
||||
setState(state);
|
||||
onStateChange(props) {
|
||||
setState(props.state);
|
||||
},
|
||||
// @ts-ignore Temporarily ignore bad typing in autocomplete-core.
|
||||
getSources({ query, state, setContext, setStatus }) {
|
||||
|
||||
getSources({ query, state: sourcesState, setContext, setStatus }) {
|
||||
if (!query) {
|
||||
if (disableUserPersonalization) {
|
||||
return [];
|
||||
|
|
@ -225,7 +223,7 @@ export function DocSearchModal({
|
|||
// We store the `lvl0`s to display them as search suggestions
|
||||
// in the "no results" screen.
|
||||
if (
|
||||
(state.context.searchSuggestions as any[]).length <
|
||||
(sourcesState.context.searchSuggestions as any[]).length <
|
||||
Object.keys(sources).length
|
||||
) {
|
||||
setContext({
|
||||
|
|
@ -254,14 +252,13 @@ export function DocSearchModal({
|
|||
groupBy(items, (item) => item.hierarchy.lvl1)
|
||||
)
|
||||
.map(transformItems)
|
||||
.map((hits) =>
|
||||
hits.map((item) => {
|
||||
.map((groupedHits) =>
|
||||
groupedHits.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
__docsearch_parent:
|
||||
item.type !== 'lvl1' &&
|
||||
hits.find(
|
||||
groupedHits.find(
|
||||
(siblingItem) =>
|
||||
siblingItem.type === 'lvl1' &&
|
||||
siblingItem.hierarchy.lvl1 ===
|
||||
|
|
@ -381,6 +378,8 @@ export function DocSearchModal({
|
|||
]
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onMouseDown={(event) => {
|
||||
if (event.target === event.currentTarget) {
|
||||
onClose();
|
||||
|
|
@ -393,12 +392,12 @@ export function DocSearchModal({
|
|||
{...autocomplete}
|
||||
state={state}
|
||||
autoFocus={initialQuery.length === 0}
|
||||
onClose={onClose}
|
||||
inputRef={inputRef}
|
||||
isFromSelection={
|
||||
Boolean(initialQuery) &&
|
||||
initialQuery === initialQueryFromSelection
|
||||
}
|
||||
onClose={onClose}
|
||||
/>
|
||||
</header>
|
||||
|
||||
|
|
@ -412,11 +411,11 @@ export function DocSearchModal({
|
|||
disableUserPersonalization={disableUserPersonalization}
|
||||
recentSearches={recentSearches}
|
||||
favoriteSearches={favoriteSearches}
|
||||
inputRef={inputRef}
|
||||
onItemClick={(item) => {
|
||||
saveRecentSearch(item);
|
||||
onClose();
|
||||
}}
|
||||
inputRef={inputRef}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { DocSearchHit } from './types';
|
||||
import type { InternalDocSearchHit, StoredDocSearchHit } from './types';
|
||||
|
||||
interface HitProps {
|
||||
hit: DocSearchHit;
|
||||
hit: InternalDocSearchHit | StoredDocSearchHit;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { NoResultsIcon } from './icons';
|
||||
import { ScreenStateProps } from './ScreenState';
|
||||
import { InternalDocSearchHit } from './types';
|
||||
import type { ScreenStateProps } from './ScreenState';
|
||||
import type { InternalDocSearchHit } from './types';
|
||||
|
||||
type NoResultsScreenProps = ScreenStateProps<InternalDocSearchHit>;
|
||||
|
||||
|
|
@ -30,6 +30,7 @@ export function NoResultsScreen(props: NoResultsScreenProps) {
|
|||
<button
|
||||
className="DocSearch-Prefill"
|
||||
key={search}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
props.setQuery(search.toLowerCase() + ' ');
|
||||
props.refresh();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import {
|
||||
import type {
|
||||
AutocompleteApi,
|
||||
AutocompleteState,
|
||||
BaseItem,
|
||||
} from '@algolia/autocomplete-core';
|
||||
import React from 'react';
|
||||
|
||||
import { DocSearchProps } from './DocSearch';
|
||||
import type { DocSearchProps } from './DocSearch';
|
||||
import { Snippet } from './Snippet';
|
||||
import { InternalDocSearchHit, StoredDocSearchHit } from './types';
|
||||
import type { InternalDocSearchHit, StoredDocSearchHit } from './types';
|
||||
|
||||
interface ResultsProps<TItem extends BaseItem>
|
||||
extends AutocompleteApi<
|
||||
|
|
@ -18,13 +18,13 @@ interface ResultsProps<TItem extends BaseItem>
|
|||
> {
|
||||
title: string;
|
||||
collection: AutocompleteState<TItem>['collections'][0];
|
||||
renderIcon(props: { item: TItem; index: number }): React.ReactNode;
|
||||
renderAction(props: {
|
||||
renderIcon: (props: { item: TItem; index: number }) => React.ReactNode;
|
||||
renderAction: (props: {
|
||||
item: TItem;
|
||||
runDeleteTransition: (cb: () => void) => void;
|
||||
runFavoriteTransition: (cb: () => void) => void;
|
||||
}): React.ReactNode;
|
||||
onItemClick(item: TItem): void;
|
||||
}) => React.ReactNode;
|
||||
onItemClick: (item: TItem) => void;
|
||||
hitComponent: DocSearchProps['hitComponent'];
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ function Result<TItem extends StoredDocSearchHit>({
|
|||
<li
|
||||
className={[
|
||||
'DocSearch-Hit',
|
||||
((item as unknown) as InternalDocSearchHit).__docsearch_parent &&
|
||||
(item as unknown as InternalDocSearchHit).__docsearch_parent &&
|
||||
'DocSearch-Hit--Child',
|
||||
isDeleting && 'DocSearch-Hit--deleting',
|
||||
isFavoriting && 'DocSearch-Hit--favoriting',
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
|
||||
import { SelectIcon, SourceIcon } from './icons';
|
||||
import { Results } from './Results';
|
||||
import { ScreenStateProps } from './ScreenState';
|
||||
import { InternalDocSearchHit } from './types';
|
||||
import type { ScreenStateProps } from './ScreenState';
|
||||
import type { InternalDocSearchHit } from './types';
|
||||
import { removeHighlightTags } from './utils';
|
||||
|
||||
type ResultsScreenProps = ScreenStateProps<InternalDocSearchHit>;
|
||||
|
|
@ -11,7 +11,7 @@ type ResultsScreenProps = ScreenStateProps<InternalDocSearchHit>;
|
|||
export function ResultsScreen(props: ResultsScreenProps) {
|
||||
return (
|
||||
<div className="DocSearch-Dropdown-Container">
|
||||
{props.state.collections.map((collection, index) => {
|
||||
{props.state.collections.map((collection) => {
|
||||
if (collection.items.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ export function ResultsScreen(props: ResultsScreenProps) {
|
|||
return (
|
||||
<Results
|
||||
{...props}
|
||||
key={index}
|
||||
key={collection.source.sourceId}
|
||||
title={title}
|
||||
collection={collection}
|
||||
renderIcon={({ item, index }) => (
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
import {
|
||||
import type {
|
||||
AutocompleteApi,
|
||||
AutocompleteState,
|
||||
BaseItem,
|
||||
} from '@algolia/autocomplete-core';
|
||||
import React from 'react';
|
||||
|
||||
import { DocSearchProps } from './DocSearch';
|
||||
import type { DocSearchProps } from './DocSearch';
|
||||
import { ErrorScreen } from './ErrorScreen';
|
||||
import { NoResultsScreen } from './NoResultsScreen';
|
||||
import { ResultsScreen } from './ResultsScreen';
|
||||
import { StartScreen } from './StartScreen';
|
||||
import { StoredSearchPlugin } from './stored-searches';
|
||||
import { InternalDocSearchHit, StoredDocSearchHit } from './types';
|
||||
import type { StoredSearchPlugin } from './stored-searches';
|
||||
import type { InternalDocSearchHit, StoredDocSearchHit } from './types';
|
||||
|
||||
export interface ScreenStateProps<TItem extends BaseItem>
|
||||
extends AutocompleteApi<
|
||||
|
|
@ -23,8 +23,8 @@ export interface ScreenStateProps<TItem extends BaseItem>
|
|||
state: AutocompleteState<TItem>;
|
||||
recentSearches: StoredSearchPlugin<StoredDocSearchHit>;
|
||||
favoriteSearches: StoredSearchPlugin<StoredDocSearchHit>;
|
||||
onItemClick(item: InternalDocSearchHit): void;
|
||||
inputRef: React.MutableRefObject<null | HTMLInputElement>;
|
||||
onItemClick: (item: InternalDocSearchHit) => void;
|
||||
inputRef: React.MutableRefObject<HTMLInputElement | null>;
|
||||
hitComponent: DocSearchProps['hitComponent'];
|
||||
indexName: DocSearchProps['indexName'];
|
||||
disableUserPersonalization: boolean;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import { AutocompleteApi, AutocompleteState } from '@algolia/autocomplete-core';
|
||||
import React, { MutableRefObject } from 'react';
|
||||
import type {
|
||||
AutocompleteApi,
|
||||
AutocompleteState,
|
||||
} from '@algolia/autocomplete-core';
|
||||
import type { MutableRefObject } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
import { MAX_QUERY_SIZE } from './constants';
|
||||
import { LoadingIcon } from './icons/LoadingIcon';
|
||||
import { ResetIcon } from './icons/ResetIcon';
|
||||
import { SearchIcon } from './icons/SearchIcon';
|
||||
import { InternalDocSearchHit } from './types';
|
||||
import type { InternalDocSearchHit } from './types';
|
||||
|
||||
interface SearchBoxProps
|
||||
extends AutocompleteApi<
|
||||
|
|
@ -17,7 +21,7 @@ interface SearchBoxProps
|
|||
state: AutocompleteState<InternalDocSearchHit>;
|
||||
autoFocus: boolean;
|
||||
inputRef: MutableRefObject<HTMLInputElement | null>;
|
||||
onClose(): void;
|
||||
onClose: () => void;
|
||||
isFromSelection: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +79,7 @@ export function SearchBox(props: SearchBoxProps) {
|
|||
</button>
|
||||
</form>
|
||||
|
||||
<button className="DocSearch-Cancel" onClick={props.onClose}>
|
||||
<button className="DocSearch-Cancel" type="reset" onClick={props.onClose}>
|
||||
Cancel
|
||||
</button>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
import { createElement } from 'react';
|
||||
|
||||
import { StoredDocSearchHit } from './types';
|
||||
import type { StoredDocSearchHit } from './types';
|
||||
|
||||
function getPropertyByPath(object: object, path: string): any {
|
||||
function getPropertyByPath(object: Record<string, any>, path: string): any {
|
||||
const parts = path.split('.');
|
||||
|
||||
return parts.reduce((current, key) => current && current[key], object);
|
||||
return parts.reduce((prev, current) => {
|
||||
if (prev?.[current]) return prev[current];
|
||||
return null;
|
||||
}, object);
|
||||
}
|
||||
|
||||
interface SnippetProps<TItem> {
|
||||
[prop: string]: unknown;
|
||||
hit: TItem;
|
||||
attribute: string;
|
||||
tagName?: string;
|
||||
[prop: string]: unknown;
|
||||
}
|
||||
|
||||
export function Snippet<TItem extends StoredDocSearchHit>({
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
|
||||
import { RecentIcon, ResetIcon, StarIcon } from './icons';
|
||||
import { Results } from './Results';
|
||||
import { ScreenStateProps } from './ScreenState';
|
||||
import { InternalDocSearchHit } from './types';
|
||||
import type { ScreenStateProps } from './ScreenState';
|
||||
import type { InternalDocSearchHit } from './types';
|
||||
|
||||
interface StartScreenProps extends ScreenStateProps<InternalDocSearchHit> {
|
||||
hasCollections: boolean;
|
||||
|
|
@ -47,6 +47,7 @@ export function StartScreen(props: StartScreenProps) {
|
|||
<button
|
||||
className="DocSearch-Hit-action-button"
|
||||
title="Save this search"
|
||||
type="submit"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -64,6 +65,7 @@ export function StartScreen(props: StartScreenProps) {
|
|||
<button
|
||||
className="DocSearch-Hit-action-button"
|
||||
title="Remove this search from history"
|
||||
type="submit"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
@ -94,6 +96,7 @@ export function StartScreen(props: StartScreenProps) {
|
|||
<button
|
||||
className="DocSearch-Hit-action-button"
|
||||
title="Remove this search from favorites"
|
||||
type="submit"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -1,17 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
export function SourceIcon(props: { type: string }) {
|
||||
switch (props.type) {
|
||||
case 'lvl1':
|
||||
return <LvlIcon />;
|
||||
case 'content':
|
||||
return <ContentIcon />;
|
||||
default:
|
||||
return <AnchorIcon />;
|
||||
}
|
||||
}
|
||||
|
||||
function LvlIcon() {
|
||||
const LvlIcon: React.FC = () => {
|
||||
return (
|
||||
<svg width="20" height="20" viewBox="0 0 20 20">
|
||||
<path
|
||||
|
|
@ -23,6 +12,17 @@ function LvlIcon() {
|
|||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
export function SourceIcon(props: { type: string }) {
|
||||
switch (props.type) {
|
||||
case 'lvl1':
|
||||
return <LvlIcon />;
|
||||
case 'content':
|
||||
return <ContentIcon />;
|
||||
default:
|
||||
return <AnchorIcon />;
|
||||
}
|
||||
}
|
||||
|
||||
function AnchorIcon() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { DocSearchHit, StoredDocSearchHit } from './types';
|
||||
import type { DocSearchHit, StoredDocSearchHit } from './types';
|
||||
|
||||
function isLocalStorageSupported() {
|
||||
const key = '__TEST_KEY__';
|
||||
|
|
@ -41,9 +41,9 @@ type CreateStoredSearchesOptions = {
|
|||
};
|
||||
|
||||
export type StoredSearchPlugin<TItem> = {
|
||||
add(item: TItem): void;
|
||||
remove(item: TItem): void;
|
||||
getAll(): TItem[];
|
||||
add: (item: TItem) => void;
|
||||
remove: (item: TItem) => void;
|
||||
getAll: () => TItem[];
|
||||
};
|
||||
|
||||
export function createStoredSearches<TItem extends StoredDocSearchHit>({
|
||||
|
|
@ -55,11 +55,8 @@ export function createStoredSearches<TItem extends StoredDocSearchHit>({
|
|||
|
||||
return {
|
||||
add(item: TItem) {
|
||||
const {
|
||||
_highlightResult,
|
||||
_snippetResult,
|
||||
...hit
|
||||
} = (item as unknown) as DocSearchHit;
|
||||
const { _highlightResult, _snippetResult, ...hit } =
|
||||
item as unknown as DocSearchHit;
|
||||
|
||||
const isQueryAlreadySaved = items.findIndex(
|
||||
(x) => x.objectID === hit.objectID
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ type ContentType =
|
|||
|
||||
interface DocSearchHitAttributeHighlightResult {
|
||||
value: string;
|
||||
matchLevel: 'none' | 'partial' | 'full';
|
||||
matchLevel: 'full' | 'none' | 'partial';
|
||||
matchedWords: string[];
|
||||
fullyHighlighted?: boolean;
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ interface DocSearchHitHighlightResult {
|
|||
|
||||
interface DocSearchHitAttributeSnippetResult {
|
||||
value: string;
|
||||
matchLevel: 'none' | 'partial' | 'full';
|
||||
matchLevel: 'full' | 'none' | 'partial';
|
||||
}
|
||||
|
||||
interface DocSearchHitSnippetResult {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { DocSearchHit } from './DocSearchHit';
|
||||
import type { DocSearchHit } from './DocSearchHit';
|
||||
|
||||
export type InternalDocSearchHit = DocSearchHit & {
|
||||
__docsearch_parent: null | InternalDocSearchHit;
|
||||
__docsearch_parent: InternalDocSearchHit | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { DocSearchHit } from './DocSearchHit';
|
||||
import type { DocSearchHit } from './DocSearchHit';
|
||||
|
||||
export type StoredDocSearchHit = Omit<
|
||||
DocSearchHit,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ import React from 'react';
|
|||
|
||||
export interface UseDocSearchKeyboardEventsProps {
|
||||
isOpen: boolean;
|
||||
onOpen(): void;
|
||||
onClose(): void;
|
||||
onInput?(event: KeyboardEvent): void;
|
||||
onOpen: () => void;
|
||||
onClose: () => void;
|
||||
onInput?: (event: KeyboardEvent) => void;
|
||||
searchButtonRef?: React.RefObject<HTMLButtonElement>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import algoliasearch from 'algoliasearch/dist/algoliasearch-lite.esm.browser';
|
||||
import { SearchClient } from 'algoliasearch/lite';
|
||||
import type { SearchClient } from 'algoliasearch/lite';
|
||||
import React from 'react';
|
||||
|
||||
import { version } from './version';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { AutocompleteApi } from '@algolia/autocomplete-core';
|
||||
import type { AutocompleteApi } from '@algolia/autocomplete-core';
|
||||
import React from 'react';
|
||||
|
||||
interface UseTouchEventsProps {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export function groupBy<TValue extends object>(
|
||||
export function groupBy<TValue extends Record<string, unknown>>(
|
||||
values: TValue[],
|
||||
predicate: (value: TValue) => string
|
||||
): Record<string, TValue[]> {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { DocSearchHit, InternalDocSearchHit } from './../types';
|
||||
import type { DocSearchHit, InternalDocSearchHit } from '../types';
|
||||
|
||||
const regexHighlightTags = /(<mark>|<\/mark>)/g;
|
||||
const regexHasHighlightTags = RegExp(regexHighlightTags.source);
|
||||
|
|
|
|||
|
|
@ -1,166 +1,169 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
||||
|
||||
// With JSDoc @type annotations, IDEs can provide config autocompletion
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
(module.exports = {
|
||||
title: 'DocSearch by Algolia',
|
||||
tagline:
|
||||
'The best search experience for docs, integrated in minutes, for free.',
|
||||
url: 'https://docsearch.algolia.com',
|
||||
baseUrl: '/',
|
||||
favicon: 'img/favicon.ico',
|
||||
organizationName: 'Algolia',
|
||||
projectName: 'DocSearch',
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||
({
|
||||
docs: {
|
||||
path: 'docs',
|
||||
sidebarPath: 'sidebars.js',
|
||||
editUrl:
|
||||
'https://github.com/algolia/docsearch/edit/next/packages/website/',
|
||||
versions: {
|
||||
current: {
|
||||
label: 'current',
|
||||
(
|
||||
module.exports = {
|
||||
title: 'DocSearch by Algolia',
|
||||
tagline:
|
||||
'The best search experience for docs, integrated in minutes, for free.',
|
||||
url: 'https://docsearch.algolia.com',
|
||||
baseUrl: '/',
|
||||
favicon: 'img/favicon.ico',
|
||||
organizationName: 'Algolia',
|
||||
projectName: 'DocSearch',
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||
({
|
||||
docs: {
|
||||
path: 'docs',
|
||||
sidebarPath: 'sidebars.js',
|
||||
editUrl:
|
||||
'https://github.com/algolia/docsearch/edit/next/packages/website/',
|
||||
versions: {
|
||||
current: {
|
||||
label: 'current',
|
||||
},
|
||||
},
|
||||
lastVersion: 'current',
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
},
|
||||
lastVersion: 'current',
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
},
|
||||
}),
|
||||
],
|
||||
],
|
||||
plugins: ['my-loaders', 'tailwind-loader'],
|
||||
themeConfig:
|
||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||
({
|
||||
algolia: {
|
||||
appId: 'R2IYF7ETH7',
|
||||
apiKey: '599cec31baffa4868cae4e79f180729b',
|
||||
indexName: 'docsearch',
|
||||
contextualSearch: true,
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
navbar: {
|
||||
hideOnScroll: true,
|
||||
logo: {
|
||||
alt: 'DocSearch',
|
||||
src: 'img/docsearch-logo.svg',
|
||||
srcDark: 'img/docsearch-logo-white.svg',
|
||||
},
|
||||
items: [
|
||||
// left
|
||||
{
|
||||
label: 'Docs',
|
||||
to: 'docs/what-is-docsearch',
|
||||
position: 'left',
|
||||
},
|
||||
// right
|
||||
{
|
||||
type: 'docsVersionDropdown',
|
||||
position: 'right',
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/algolia/docsearch',
|
||||
position: 'right',
|
||||
className: 'header-github-link',
|
||||
},
|
||||
],
|
||||
},
|
||||
colorMode: {
|
||||
defaultMode: 'light',
|
||||
disableSwitch: false,
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
announcementBar: {
|
||||
content:
|
||||
'⭐️ If you like DocSearch, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/algolia/docsearch">GitHub</a>! ⭐️',
|
||||
},
|
||||
footer: {
|
||||
links: [
|
||||
{
|
||||
title: 'Docs',
|
||||
items: [
|
||||
{
|
||||
label: 'Getting Started',
|
||||
to: 'docs/what-is-docsearch',
|
||||
},
|
||||
{
|
||||
label: 'FAQ',
|
||||
to: 'docs/faq',
|
||||
},
|
||||
{
|
||||
label: 'DocSearch v3',
|
||||
to: 'docs/DocSearch-v3',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'DocSearch',
|
||||
items: [
|
||||
{
|
||||
label: 'Apply',
|
||||
to: 'apply',
|
||||
},
|
||||
{
|
||||
label: 'Issues',
|
||||
to: 'https://github.com/algolia/docsearch/issues',
|
||||
},
|
||||
{
|
||||
label: 'Privacy',
|
||||
to: 'https://www.algolia.com/policies/privacy/',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Community',
|
||||
items: [
|
||||
{
|
||||
label: 'Forum',
|
||||
to: 'https://discourse.algolia.com/tags/docsearch',
|
||||
},
|
||||
{
|
||||
label: 'Discord',
|
||||
to: 'https://discord.com/invite/bRTacwYrfX',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Social',
|
||||
items: [
|
||||
{
|
||||
label: 'GitHub',
|
||||
to: 'https://github.com/algolia/docsearch',
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
to: 'https://twitter.com/docsearch_',
|
||||
},
|
||||
{
|
||||
label: 'Algolia Blog',
|
||||
to: 'https://algolia.com/blog/',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
logo: {
|
||||
alt: 'Algolia',
|
||||
src: 'img/algolia-logo.svg',
|
||||
},
|
||||
copyright: 'DocSearch 2015-now • Designed and built by Algolia',
|
||||
},
|
||||
image: 'img/og_image.png',
|
||||
prism: {
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme,
|
||||
},
|
||||
}),
|
||||
],
|
||||
],
|
||||
plugins: ['my-loaders', 'tailwind-loader'],
|
||||
themeConfig:
|
||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||
({
|
||||
algolia: {
|
||||
appId: 'R2IYF7ETH7',
|
||||
apiKey: '599cec31baffa4868cae4e79f180729b',
|
||||
indexName: 'docsearch',
|
||||
contextualSearch: true,
|
||||
},
|
||||
navbar: {
|
||||
hideOnScroll: true,
|
||||
logo: {
|
||||
alt: 'DocSearch',
|
||||
src: 'img/docsearch-logo.svg',
|
||||
srcDark: 'img/docsearch-logo-white.svg',
|
||||
},
|
||||
items: [
|
||||
// left
|
||||
{
|
||||
label: 'Docs',
|
||||
to: 'docs/what-is-docsearch',
|
||||
position: 'left',
|
||||
},
|
||||
// right
|
||||
{
|
||||
type: 'docsVersionDropdown',
|
||||
position: 'right',
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/algolia/docsearch',
|
||||
position: 'right',
|
||||
className: 'header-github-link',
|
||||
},
|
||||
],
|
||||
},
|
||||
colorMode: {
|
||||
defaultMode: 'light',
|
||||
disableSwitch: false,
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
announcementBar: {
|
||||
content:
|
||||
'⭐️ If you like DocSearch, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/algolia/docsearch">GitHub</a>! ⭐️',
|
||||
},
|
||||
footer: {
|
||||
links: [
|
||||
{
|
||||
title: 'Docs',
|
||||
items: [
|
||||
{
|
||||
label: 'Getting Started',
|
||||
to: 'docs/what-is-docsearch',
|
||||
},
|
||||
{
|
||||
label: 'FAQ',
|
||||
to: 'docs/faq',
|
||||
},
|
||||
{
|
||||
label: 'DocSearch v3',
|
||||
to: 'docs/DocSearch-v3',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'DocSearch',
|
||||
items: [
|
||||
{
|
||||
label: 'Apply',
|
||||
to: 'apply',
|
||||
},
|
||||
{
|
||||
label: 'Issues',
|
||||
to: 'https://github.com/algolia/docsearch/issues',
|
||||
},
|
||||
{
|
||||
label: 'Privacy',
|
||||
to: 'https://www.algolia.com/policies/privacy/',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Community',
|
||||
items: [
|
||||
{
|
||||
label: 'Forum',
|
||||
to: 'https://discourse.algolia.com/tags/docsearch',
|
||||
},
|
||||
{
|
||||
label: 'Discord',
|
||||
to: 'https://discord.com/invite/bRTacwYrfX',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Social',
|
||||
items: [
|
||||
{
|
||||
label: 'GitHub',
|
||||
to: 'https://github.com/algolia/docsearch',
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
to: 'https://twitter.com/docsearch_',
|
||||
},
|
||||
{
|
||||
label: 'Algolia Blog',
|
||||
to: 'https://algolia.com/blog/',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
logo: {
|
||||
alt: 'Algolia',
|
||||
src: 'img/algolia-logo.svg',
|
||||
},
|
||||
copyright: 'DocSearch 2015-now • Designed and built by Algolia',
|
||||
},
|
||||
image: 'img/og_image.png',
|
||||
prism: {
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme,
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
module.exports = function () {
|
||||
return {
|
||||
name: 'postcss-tailwindcss-loader',
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
- render a sidebar for each doc of that group
|
||||
- provide next/previous navigation
|
||||
|
||||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
* - create an ordered group of docs
|
||||
* - render a sidebar for each doc of that group
|
||||
* - provide next/previous navigation.
|
||||
*
|
||||
* The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
*
|
||||
* Create as many sidebars as you want.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
|
|
@ -16,12 +16,18 @@ function ApplyForm() {
|
|||
const [url, setUrl] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
|
||||
function onSubmit(event) {
|
||||
const handleSetUrl = (event) => {
|
||||
setUrl(event.target.value);
|
||||
};
|
||||
const handleSetEmail = (event) => {
|
||||
setEmail(event.target.value);
|
||||
};
|
||||
const onSubmit = (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const applyForm = event.target;
|
||||
const method = applyForm.getAttribute('method');
|
||||
const url = applyForm.getAttribute('action');
|
||||
const action = applyForm.getAttribute('action');
|
||||
const formData = new FormData(applyForm);
|
||||
const data = {};
|
||||
formData.forEach(function (value, key) {
|
||||
|
|
@ -29,7 +35,7 @@ function ApplyForm() {
|
|||
});
|
||||
const body = JSON.stringify(data);
|
||||
|
||||
fetch(url, {
|
||||
fetch(action, {
|
||||
method,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
|
|
@ -38,7 +44,7 @@ function ApplyForm() {
|
|||
setHasSent(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (hasSent) {
|
||||
return (
|
||||
|
|
@ -68,26 +74,26 @@ function ApplyForm() {
|
|||
return (
|
||||
<Card className="uil-m-auto apply-form uil-pb-24">
|
||||
<form
|
||||
onSubmit={onSubmit}
|
||||
id="form-apply-docsearch"
|
||||
method="POST"
|
||||
action="https://docsearch-hub.herokuapp.com/form/inbound"
|
||||
onSubmit={onSubmit}
|
||||
>
|
||||
<LabelText key="url" tag="label" htmlFor="url" className="apply-text">
|
||||
Documentation or Blog URL
|
||||
<Input
|
||||
required={true}
|
||||
id="url"
|
||||
type="url"
|
||||
name="url"
|
||||
aria-label="URL of the open-source blog or documentation website"
|
||||
value={url}
|
||||
onChange={(event) => setUrl(event.target.value)}
|
||||
placeholder="https://project.org/docs"
|
||||
required
|
||||
onChange={handleSetUrl}
|
||||
/>
|
||||
</LabelText>
|
||||
|
||||
<Text small className="uil-pv-8 uil-d-block apply-text">
|
||||
<Text small={true} className="uil-pv-8 uil-d-block apply-text">
|
||||
We'll scrape pages at this address and index the content on Algolia.
|
||||
</Text>
|
||||
|
||||
|
|
@ -99,18 +105,18 @@ function ApplyForm() {
|
|||
>
|
||||
Email
|
||||
<Input
|
||||
required={true}
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
aria-label="Email address of the owner of this website"
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
placeholder="you@project.org"
|
||||
required
|
||||
onChange={handleSetEmail}
|
||||
/>
|
||||
</LabelText>
|
||||
|
||||
<Text small className="uil-pv-8 uil-d-block apply-text">
|
||||
<Text small={true} className="uil-pv-8 uil-d-block apply-text">
|
||||
We'll send you the snippet you'll have to integrate into your website
|
||||
and grant access to your Algolia application.
|
||||
</Text>
|
||||
|
|
@ -123,12 +129,12 @@ function ApplyForm() {
|
|||
key="public"
|
||||
>
|
||||
<input
|
||||
required={true}
|
||||
id="public"
|
||||
name="public"
|
||||
aria-label="Confirm my website is publicly available"
|
||||
type="checkbox"
|
||||
className="uil-mr-8"
|
||||
required
|
||||
/>
|
||||
My website is publicly available
|
||||
</LabelText>
|
||||
|
|
@ -140,12 +146,12 @@ function ApplyForm() {
|
|||
key="opensource"
|
||||
>
|
||||
<input
|
||||
required={true}
|
||||
id="opensource"
|
||||
name="opensource"
|
||||
aria-label="Confirm my website is an technical documentation of an open-source project or technical blog"
|
||||
type="checkbox"
|
||||
className="uil-mr-8"
|
||||
required
|
||||
/>
|
||||
My website is a technical documentation of an open-source project or
|
||||
a technical blog
|
||||
|
|
@ -158,12 +164,12 @@ function ApplyForm() {
|
|||
key="owner"
|
||||
>
|
||||
<input
|
||||
required={true}
|
||||
id="owner"
|
||||
name="owner"
|
||||
aria-label="Confirm I am owner of the website"
|
||||
type="checkbox"
|
||||
className="uil-mr-8"
|
||||
required
|
||||
/>
|
||||
I'm the owner of the website and I have{' '}
|
||||
<InlineLink href={withBaseUrl('docs/who-can-apply')}>
|
||||
|
|
@ -172,17 +178,17 @@ function ApplyForm() {
|
|||
</LabelText>
|
||||
|
||||
<Button
|
||||
primary={true}
|
||||
className="uil-mt-16 uil-mb-16"
|
||||
tag="button"
|
||||
type="submit"
|
||||
id="joinButton"
|
||||
primary
|
||||
>
|
||||
Join the program
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Text className="uil-ta-center" small>
|
||||
<Text small={true} className="uil-ta-center">
|
||||
<InlineLink href="https://www.algolia.com/policies/terms">
|
||||
Refer to Algolia's Privacy Policy for more information on how we use
|
||||
and protect your data
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ function Home() {
|
|||
src={withBaseUrl('img/assets/scraping.svg')}
|
||||
width="190px"
|
||||
height="220px"
|
||||
alt="Scraping with Algolia Crawler"
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-10 lg:mt-0 p-4">
|
||||
|
|
@ -289,6 +290,7 @@ function Home() {
|
|||
src={withBaseUrl('img/assets/configuration.svg')}
|
||||
width="140px"
|
||||
height="220px"
|
||||
alt="Configuration of your crawler"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -307,6 +309,7 @@ function Home() {
|
|||
src={withBaseUrl('img/assets/implementation.svg')}
|
||||
width="220px"
|
||||
height="220px"
|
||||
alt="Implementation on your website"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue