Skip to content

Commit ac90dce

Browse files
authored
docs: general cleanup (#503)
* docs: change Discord link * docs: space out the embedded example more * docs: add missing `sourceId` * docs: fix code background color in admonitions * docs: fix homepage content * style: format * style: format
1 parent 2daaf98 commit ac90dce

12 files changed

+39
-15
lines changed

packages/website/docs/autocomplete-js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const autocompleteSearch = autocomplete({
5757
getSources() {
5858
return [
5959
{
60-
sourceId: 'querySuggestionsSources',
60+
sourceId: 'querySuggestions',
6161
getItemInputValue: ({ item }) => item.query,
6262
getItems({ query }) {
6363
return getAlgoliaHits({

packages/website/docs/basic-options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ autocomplete({
1919
getSources() {
2020
return [
2121
{
22+
sourceId: 'links',
2223
getItems({ query }) {
2324
return [
2425
{ label: 'Twitter', url: 'https://twitter.com' },

packages/website/docs/createAutocomplete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const autocomplete = createAutocomplete({
5252
getSources() {
5353
return [
5454
{
55-
sourceId: 'querySuggestionsSource',
55+
sourceId: 'querySuggestions',
5656
getItemInputValue: ({ item }) => item.query,
5757
getItems({ query }) {
5858
return getAlgoliaHits({

packages/website/docs/keyboard-navigation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The Navigator API defines three navigation schemes based on key combinations:
1919

2020
To activate keyboard navigation, you need to implement a [`getItemUrl`](createAutocomplete#getitemurl) function in each of your [sources](/docs/sources) to provide the URL to navigate to. It tells the Navigator API which link to open on <kbd>Enter</kbd>.
2121

22-
```js {6-8}
22+
```js {7-9}
2323
autocomplete({
2424
// ...
2525
getSources() {
@@ -30,7 +30,9 @@ autocomplete({
3030
return item.url;
3131
},
3232
getItems() {
33-
return [];
33+
return [
34+
// ...
35+
];
3436
},
3537
},
3638
];

packages/website/docs/plugins.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const gitHubReposPlugin = {
5959
getSources() {
6060
return [
6161
{
62+
sourceId: 'githubPlugin',
6263
getItems() {
6364
return [
6465
{ name: 'algolia/autocomplete.js', stars: 1237 },
@@ -114,6 +115,7 @@ export function createGitHubReposPlugin(options) {
114115
.then((repositories) => {
115116
return [
116117
{
118+
sourceId: 'githubPlugin',
117119
getItems() {
118120
return repositories.items;
119121
},

packages/website/docs/sending-algolia-insights-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ autocomplete({
5454
getSources({ query }) {
5555
return [
5656
{
57+
sourceId: 'products',
5758
getItems() {
5859
return getAlgoliaHits({
5960
searchClient,

packages/website/docs/sources.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ autocomplete({
2121
getSources() {
2222
return [
2323
{
24-
sourceId: 'staticSource',
24+
sourceId: 'links',
2525
getItems() {
2626
return [
2727
{ label: 'Twitter', url: 'https://twitter.com' },
@@ -50,7 +50,7 @@ autocomplete({
5050
getSources() {
5151
return [
5252
{
53-
sourceId: 'staticSource',
53+
sourceId: 'links',
5454
getItems({ query }) {
5555
return [
5656
{ label: 'Twitter', url: 'https://twitter.com' },
@@ -146,7 +146,7 @@ autocomplete({
146146
getSources() {
147147
return [
148148
{
149-
sourceId: 'algoliaHits',
149+
sourceId: 'products',
150150
getItems({ query }) {
151151
return getAlgoliaHits({
152152
searchClient,
@@ -185,6 +185,7 @@ autocomplete({
185185
.then(({ predictions }) => {
186186
return [
187187
{
188+
sourceId: 'predictions',
188189
getItems() {
189190
return predictions;
190191
},
@@ -236,7 +237,7 @@ autocomplete({
236237

237238
return [
238239
{
239-
sourceId: 'querySuggestionsSource',
240+
sourceId: 'querySuggestions',
240241
getItems() {
241242
return suggestions.hits;
242243
},
@@ -245,7 +246,7 @@ autocomplete({
245246
},
246247
},
247248
{
248-
sourceId: 'algoliaHits',
249+
sourceId: 'products',
249250
getItems() {
250251
return products.hits;
251252
},

packages/website/docs/using-react.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function App() {
104104
getSources={({ query }) =>
105105
[
106106
{
107+
sourceId: 'products',
107108
getItems() {
108109
return getAlgoliaHits({
109110
searchClient,

packages/website/docusaurus.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ module.exports = {
6363
},
6464
{
6565
label: 'Discord',
66-
href: 'https://discord.gg/tXdr5mP',
66+
href:
67+
'https://discord.com/channels/477328979074744322/823816543136907264',
6768
},
6869
],
6970
},

packages/website/src/components/AutocompleteExample.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export function AutocompleteExample<TItem extends BaseItem>(
3333
<div
3434
ref={containerRef}
3535
style={{
36-
margin: 'auto',
37-
marginBottom: 'var(--ifm-paragraph-margin-bottom)',
36+
margin: 'calc(var(--ifm-paragraph-margin-bottom) * 2) auto',
3837
maxWidth: 540,
3938
}}
4039
/>

0 commit comments

Comments
 (0)