mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.57k stars 32.19k forks source link

[docs-infra] Implement search engine in v5 documentation page #29445

Open PabloLION opened 2 years ago

PabloLION commented 2 years ago

Summary 💡

Examples 🌈

SCR-20240302-qheu

Motivation 🔦

Usability

PabloLION commented 2 years ago

This is also about the search function although its not about the search bar component on the web. Linking it with #28415.

Also I'm thinking about making an PR to solve this issue. So if there's no one doing this right now, maybe @mnajdova can assign this to me? I asked because it might take more time to discuss about the PR than assigning someone inside the team to do it. For example, I don't know how do you think about the idea "direct to the homepage with abcdef inputed in search pop-up." Maybe you want another way to achieve the effect?

PabloLION commented 2 years ago

Hi @mnajdova. Recently I've been busy. I will try it next week on Christmas vacation.

mnajdova commented 2 years ago

@siriwatknp @hbjORbj before @PabloLION starts do you have some tips/doubts around this?

siriwatknp commented 2 years ago

@siriwatknp @hbjORbj before @PabloLION starts do you have some tips/doubts around this?

From my understanding, the intention of @PabloLION is to improve the UX of the search. If there is no impact on the current behavior, I don't have any objection.

PabloLION commented 2 years ago

I confirm what @siriwatknp said, that my PR will not change any function of current function. I just took a look at the repo and it's so clean! I like it a lot! (although there's a typo in docs/pages/index.tsx, you'll see it in the PR)

However, I'm failing to locate where does the route happens: I see in docs/pages/_app.js there's a findActivePage methods seems to do this job, yet it is in a JS file. Does the _app.js imply that it's outdated and needs updating to JS? or you are keeping it deliberately a JS file?

My plan would be to first change https://mui.com/search to the homepage with the <DeferredAppSearch> opened. Then add the query string to the search box. And do some exact match like when search keyword isbutton api. Then add the search engine function of chrome (I've never used mozilla or other browsers, maybe you need to add it yourself, maybe it's a tag which works cross-browser)

mnajdova commented 2 years ago

Should I change this docs/pages/_app.js file to add a new route?

all pages are inside docs/src/pages.ts

How does the plan sound to you?

Sounds good, let's start and once we have something working we can polish it :)

PabloLION commented 2 years ago

Hi, @mnajdova

Should I change this docs/pages/_app.js file to add a new route?

Now I clearly see why this file doesn't need to be changed. It seems a next.js wrapper.

PabloLION commented 2 years ago

I didn't finish the part of automatic adding to search engine. It seems I need to create a new "OpenSearch description file". Yet I don't have the access to your netlify or other servers.

@siriwatknp, maybe you can consider doing this.

oliviertassinari commented 2 years ago

This seems to be a continuation of #16764, great.