Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: write "what is autocomplete"? #393

Merged
merged 36 commits into from Feb 4, 2021

Conversation

Meschreiber
Copy link
Contributor

This PR writes the first introduction page, "What is autocomplete".

It describes:

  1. what an autocomplete experience is, in general,
  2. what this library does and doesn't provide.

I feel like the second part is still a bit weak and could use some more technical details, so please suggest any you see missing. Thanks!

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 14, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 76ecdc3:

Sandbox Source
@algolia/js-example Configuration
@algolia/react-renderer-example Configuration

@Meschreiber Meschreiber changed the title feat: add intro docs: add "what is autocomplete"? Jan 15, 2021
@Meschreiber Meschreiber changed the title docs: add "what is autocomplete"? docs: write "what is autocomplete"? Jan 15, 2021
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
packages/website/docs/introduction.md Outdated Show resolved Hide resolved
Co-authored-by: Sarah Dayan <sarah.dayan@algolia.com>
@Meschreiber
Copy link
Contributor Author

Thanks for the thorough review @sarahdayan !

Right after this section I think we should have a video that showcases a basic autocomplete with some patterns. This is a visual topic, so I think we should show in addition to telling.

I agree. I was originally thinking of adding the video I added to the internal autocomplete docs, but decided against it since it's not using this library. I'll create a new one for this purpose.

@sarahdayan
Copy link
Member

sarahdayan commented Jan 16, 2021

Maybe @francoischalifour has a good looking demo we could use?

@francoischalifour
Copy link
Member

Maybe @francoischalifour has a good looking demo we could use?

For now we can use https://lkrug.csb.app which is the preview of the always-updated sandbox.

@Meschreiber
Copy link
Contributor Author

Maybe @francoischalifour has a good looking demo we could use?

For now we can use https://lkrug.csb.app which is the preview of the always-updated sandbox.

Sounds good, I'll make a small video file.

In an intro page, I think this is better than embedding a demo since it does everything for the user. In subsequent pages we can link/embed the demo itself.

WDYT? @francoischalifour @sarahdayan

@francoischalifour
Copy link
Member

A video would be great but I think it's a little bit early since the API is still changing (I'm thinking about #381).

What are you planning to address in the video?

sarahdayan and others added 7 commits January 20, 2021 17:00
…ethod (#395)

* Implements `empty` template and `renderEmpty` method

* Add wait function to `test/utils` folder

Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>
* feat(js): change renderer implementation to virtual DOM

* feat(highlighting): revamp highlighting system to VDOM (#399)
@Meschreiber
Copy link
Contributor Author

We can leave that off until a v2 of docs though, when the API is stable.

Yes, that makes sense. Could we then embed an autocomplete experience right in the page, maybe after the second paragraph? That would be a nice touch, and we could say "try typing the letter "s" in the search box below" instead of "try typing the letter "s" in the search box on the top right of this site".

I know I'm a broken record with the Vue.js docs, but they have that in their docs and that's super nice, as you can try what you just read about right in the page: https://vuejs.org/v2/guide/#Handling-User-Input

Totally agree! Was actually just thinking of injecting the example into the getting started page after outlining it. What's the best way to do that in the context of Docusaurus? Just put in the markup container and include a separate script file to call?

@sarahdayan
Copy link
Member

sarahdayan commented Jan 28, 2021

My guess would be using an iframe to one of our CodeSandbox demos but I haven't actually tried it.

@francoischalifour
Copy link
Member

We can wrap autocomplete in a React component to insert it in the MDX. That's how I did it in the experimental website at the time.

For now we can add placeholders, @yannickcr is working on a generic solution for that.

@sarahdayan
Copy link
Member

Ah yes indeed, I forgot that Docusaurus supports MDX. So much better!

Copy link
Member

@sarahdayan sarahdayan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Meschreiber
Copy link
Contributor Author

Meschreiber commented Feb 1, 2021

Hey @francoischalifour , since merging the latest docs-1, I'm having build failures, would you let me know if I've missed something please?

I also used the super simple (even without highlighting) autocomplete example from "getting started" here.

Is this what we were thinking, or should we somehow recreate the actual docsearch UX in this first introductory example?

Also: I originally used htm to display each item, but decided that was probably unnecessary. Now I'm running into issues that I'm using a separate component. Would also love your help with that. Thanks!

@francoischalifour
Copy link
Member

@Meschreiber Sorry, I messed the merge with next. It should be fixed in e36ea32.

The example is what I had in mind. We'll rework the design later.

yarn.lock Outdated Show resolved Hide resolved
packages/website/src/components/AutocompleteItem.tsx Outdated Show resolved Hide resolved
@Meschreiber
Copy link
Contributor Author

@francoischalifour I’m still not sure what I’m messing up when using the <AutocompleteExample/> here. Since removing htm and importing a typed component, I’m getting Cannot add property __, object is not extensible error.

I also get the error when using a non-typed function directly in the file without importing it. No issues in other guides where I'm not providing an item template.

To reproduce, yarn start this branch and try typing into the autocomplete on the "what is autocomplete" page.

Any help greatly appreciated!

Once this is set, I'd love to merge it and then use the same component in "Getting started". Thanks in advance!

@francoischalifour
Copy link
Member

@Meschreiber In this guide, AutocompleteExample didn't work because we were using React components (which translate to createElement) with a Preact renderer. I updated the implementation in d10f3b9 to use a React renderer so it now works with components as well.

@Meschreiber
Copy link
Contributor Author

Thanks @francoischalifour , merging!

@Meschreiber Meschreiber merged commit 48fc7da into docs-1 Feb 4, 2021
@francoischalifour francoischalifour deleted the docs/intro/what-is-autocomplete branch April 29, 2021 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants