zaphosting / docs

Our ZAP-Hosting Community Guides
https://zap-hosting.com/guides
16 stars 64 forks source link

Offer coupon below TOC in sidebar and other minor changes #1248

Closed zapaul closed 1 month ago

zapaul commented 1 month ago

In the future, we will offer a coupon in the sidebar of the docs. While working on this, I noticed a few more things that could be improved a bit in my opinion.

NOTE: Feel free to take a look at the code already if everything is fine from your perspective, but please DO NOT merge this yet as the voucher endpoint in the main application is pending deployment.

So the PR roughly does this:

I never used React before. Feel free to tell me if the code makes you wanna unalive yourself and why.

A few other notes:

fgalz commented 1 month ago

The sidebar has been widened slightly so that all the entries do not become a two-liner when one or two sub-categories are opened. This can be seen particularly well under Gameserver -> FiveM -> ... We should probably not stick to 250 pixels here. Maybe 300 instead of 350 pixels?

If you have the project open in Visual Studio Code and Node.js is installed, you can run the full build with F5. This will then build the complete page for DE and EN. If you use npm start, only the English version will be generated. Alternatively, you can also use the following command.

npm i | npm run docusaurus clear | npm run docusaurus build | npm run docusaurus serve

The use of TailwindCSS has to be looked at again, the question is how much is added and how suitable it is. We already use a few React components for the product cards and YouTube integrations. So this might be a good idea for the future.

zapaul commented 1 month ago

The sidebar has been widened slightly so that all the entries do not become a two-liner when one or two sub-categories are opened.

Is two lines an issue? Some are in two lines already anyways, I don't think this is something that can be prevented altogether or needs to be prevented in the first place. It looks okay to me. What I noticed looking at this is that we might want to decrease the font-size by a pixel or two. Try 14px for example, what do you think?

If you use npm start, only the English version will be generated.

That was it, thanks :) Translations work fine, everything looks good to me in the full build.

the question is how much is added and how suitable it is.

How much is added in terms of how heavy the final build that is served to the users will be? TailwindCSS is very lightweight, that won't be an issue. The more custom stuff we add, the more CSS classes we will have, the bigger the build. With TailwindCSS, you mostly only use the same small set of classes and TailwindCSS only includes the classes you actually used in the final build. So it will not really grow over time. I looked up a few guides when I wrote the message above, it looks pretty doable: https://dev.to/shannonajclarke/using-tailwindcss-v3-in-docusaurus-in-5-steps-5c26 We basically configure TailwindCSS as usual and add a plugin to the Docusaurus config.

fgalz commented 1 month ago

Whether a two-liner is a serious problem is ultimately a personal opinion. However, this only takes up more vertical space and lengthens the list. I have already adjusted the font sizes in the past (they were even larger before) and have also shortened or generalized the sidebar titles.

I think adjusting the sidebar to 300 pixels and reducing the font size would be the perfect solution. What do you think?

TailwindCSS is probably not a bad idea for the future.

ThatGuyJacobee commented 1 month ago

Overall changes sound good, voucher stuff is a nice addition for the future :)

I hear the point about the sidebar currently being too wide, but I believe that after these changes it is now ultra-cramped. Perhaps meeting halfway and re-adding 50px to the width would be perfect (as Florian has also suggested)? And regarding the two-line overflowing stuff, I think it looks fine, but it is up to preference of course.

I can vouch for TailwindCSS from previous experiences as long as it can be implemented into Docusarus well. Would make working with CSS much simpler going forward and I'm sure there are performance and build benefits as Paul has mentioned. Can be considered sometime in the future for sure.

zapaul commented 1 month ago

meeting halfway

Sounds just fair, I'll take the 50px reduction :)

Closing this one since new requests from Marvin will require the coupon system to use code from a different PR I was working on and vice versa. I'll create a single big branch and PR for all of it to make the process a little easier. I'll take the 50px, font size and some other possible stuff I notice along the way into account.