andy-hanson / crow

Crow programming language
https://crow-lang.org
Other
17 stars 1 forks source link

Better navigation for documentation modules #2

Open andy-hanson opened 2 years ago

andy-hanson commented 2 years ago

At https://crow-lang.org/doc, the left navigation bar has a line for every module in the standard library. This makes the page too tall.

I think the solution is to have a collapsed section for each directory (probably using details). I'm ambivalent about whethere there is recursive nesting where crow/io/net/ goes inside crow/io/, or if it's just its own section.

bnn1 commented 2 years ago

@andy-hanson there's an easier solution, I think, but I'm not sure if it will fit you. Did you consider making left navigation scrollable?

andy-hanson commented 2 years ago

I think that would be better than the way it is now. I think the best solution would be to do both. A bigger improvement would be #3, but that's a lot more work.

bnn1 commented 2 years ago

If you don't need to handle complex cases, simple search can be implemented without any library. It only needs an array of objects {label:string;href:string} and some filtering function like arr.filter((navSection) => navSection.includes(userInput)). It won't hurt to use something like fuse.js though.

I wanna try to take on these issues. Could you provide some details on the tasks? Basically I need to know what files to modify, i.e. which file contains navbar. I also need to research crow because I have no idea what's going on in crow files :D

andy-hanson commented 2 years ago

It's late so here's the quick explanation:

bnn1 commented 2 years ago

So you want to programmatically manipulate DOM, i.e. add input element and search for specific doc page, group doc pages by sections, all using client-side js, is that right?

andy-hanson commented 2 years ago

I'm ambivalent whether the navigation is generated on the server or on the client -- if the changes to make aren't too great it may be simpler to continue doing it on the server. For the search box it's most convenient to do it on the client -- it makes deploying the site easier if there's no code running on the server, and the data to search shouldn't be too big, so I suspect search will be faster on the client anyway.

I think the different doc pages for each module should still be separate HTML documents with separate URLs, though.

bnn1 commented 2 years ago

so I added input element to navbar and styled it a little. will do search logic now result

andy-hanson commented 2 years ago

Looks good! If you need any help with the rest, I'll be monitoring https://gitter.im/crow-lang-org/community .