-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
WiP: Integrate docusaurus 2 #247
Conversation
* Migrate to docusaurus 2 * Change docs to MDX format * Make custom 404 compatible with Docusaurus v2 * Removes unwated stuffs as suggested by @endiliey
7516784
to
ddf04c5
Compare
I think its netlify redirect. We can ignore that I think the netlify preview won't work due to different build folder of v1 vs v2 https://v2.docusaurus.io/docs/migrating-from-v1-to-v2#update-references-to-the-build-directory |
Erm... those redirects appear to be left over from React-Redux and aren't relevant here :) |
It seems that there are some build errros, might need to investigate. It's currently midnight during my time now and I'm quite occupied this weekend with family's plan. I'll push to Wei's PR maybe in next couple of days. |
website/docusaurus.config.js
Outdated
theme: { | ||
customCss: [ | ||
require.resolve('./src/css/custom.css'), | ||
require.resolve('./src/css/monokai.css') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this not a good idea to do this since this means this css will be bundled into main bundle, not when its needed. It will also conflict with the default inline style theme by docusaurus.
The css need to be converted like this https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/themes/palenight.js
and set through “themeConfig.prism.theme”
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am aware of the converted method although i feel its not completely necessary for the extra work because
- most if not all pages need this
- if theres a specificity conflict this theme css should have the lowest specificity to be overwritten by higher specificity selector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I guess its OK because its roughly ~2kb. And the only page that doesn't need it is custom pages.
website/docusaurus.config.js
Outdated
theme: { | ||
customCss: [ | ||
require.resolve('./src/css/custom.css'), | ||
require.resolve('./src/css/monokai.css') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the cause of build error >.<
It does not accept array.
https://github.com/facebook/docusaurus/blob/72792a1e5ce19626a591794dc02446749b0193fe/packages/docusaurus-theme-classic/src/index.js#L20
I spent 1 hr + to debug :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- how come the css works then?
- how to fix this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- how come the css works then?
It doesn't work perfectly. Its probably some weird and unwanted behavior of webpack or some caching. At least in my side the TOC couldnt appear, and refresh sometimes cause blank page
I've mentioned on Discord that its generating require([])
export default [
require("infima/dist/css/default/default.css"),
require(["/mnt/c/Users/endij/Desktop/Linux/redux-starter-kit/my-website/src/css/custom.css","/mnt/c/Users/endij/Desktop/Linux/redux-starter-kit/my-website/src/css/monokai.css"]),
];
- HOW TO FIX
Don't use array. Choose any of this
- Either convert the css to theme (recommended since 2kbs on home page although small is still unused css)
- From custom.css import the monokai css
- Copy monokai css to custom css
- Put it in static folder, and use
stylesheets
field in siteconfig - Patch docusaurus to support array in theme-classic customCss options
- Many more ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol forgive me, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway i fixed it :( its very easy to generate the prism theme.js
Thanks for the hard work
…eme instead of css" Co-authored-by: Endi <[email protected]>
Deploy preview for redux-starter-kit-docs ready! Built with commit 56bba80 https://deploy-preview-247--redux-starter-kit-docs.netlify.com |
Sorry it took long @markerikson, finally got the time to patch this PR. Was occupied with docusaurus 2 dev itself, including work on versioning. Anyway, try to take a look at https://deploy-preview-247--redux-starter-kit-docs.netlify.com/ |
So, FYI, I just renamed the package from "Redux Starter Kit" to "Redux Toolkit" :) That involved a lot of changes to the content and the site config. All of those will need to be integrated into this branch. |
Done. It seems that during migration by previous person, there might be something that got missed especially on |
Yeah. My main concern is with the content of the pages. When I was skimming the PR changes earlier, I thought I saw some conversion of the CodeSandbox embeds from embedded HTML to JSX syntax somehow (and also maybe parts of the doc content too?). Don't want anything to get lost in the translation there. |
That's intentional because we use MDX now, so style attributes are props now and have to be objects. The end results are the same though. I ran the fork locally and made some tweaks. It looks great! Thanks @wgao19 and @endiliey for their efforts in pushing this through! |
Skimming through the site, some style-related observations:
It does look good overall! Just wondering how many of these can easily be tweaked. |
I’ve tweaked the css again and it should look somewhat similar now. In v1 we use highlightjs but v2 uses prismjs so how they tokenize might be slightly different.
Oops that seems like a bug.at first glance. Need to investigate, As for the rest its very coupled to how infima (a css framework we are using for Docusaurus) so maybe @yangshun can give better explanation on that |
Fix in facebook/docusaurus#1992. Hopefully next release if got merged |
Looking better overall. The column width, inline code snippets, and link colors still feel a bit off, but I guess those can be tweaked if we want to. Anything else you feel needs to be done before this is ready? |
Not really. Actually stuff like the top nav bar color can be changed. Same case for link colors (but it was intended to use primary colors as link color now). We can always adjust the inline code snippets color as well. Its just CSS. One thing I'd love to point out is probably the fact that the navigation to page feels almost instant now |
Yep, definitely feels faster. Think it's good to merge, then? |
Hmm i think its ok to merge ? The author of this PR is @wgao19 though, she might want to add something ?? |
- border radius should be 3px - bg color should be rgba(27, 31, 35, 0.05)
- anchor color should be blue - visited color should be redux purple
- outline and link colors should be redux purple - hover effect flips color and bg
I just pushed a few commits addressing part of the styling issues:
The spacing between left (sidebar) and main content now does look very off to me. This is a cannot unsee situation for me now because the layout looks asymmetrical. Unfortunately I don't have a quick solution. Would like to suggest that we fix the asymmetrical spacing with Docusaurus WDYT @yangshun? Above said, could @markerikson please review the styling changes and merge? And thank you for all the suggestions and support adapting to Docusaurus 2! |
Speaking of accessibility, I feel the primary color doesn't work well with the dark mode neither. |
I've played around with a few options, all had its own complexities:
Since the current Redux Toolkit site doesn't have dark mode, I feel the most sensible solution is to disable dark mode for now. If we are to enable dark mode in the future, we would have to consider the colors and accessibility issues then. |
HAH! YOU'RE WELCOME! :) |
Awright, let's go ahead and merge this in, then. If you have any further style tweaks, please go ahead and file additional PRs. Think you folks could tackle upgrading the React-Redux docs next? Hopefully that should go a bit faster now that we've got the RTK upgrade as an example. |
Oh, and thank you very much to all of you for your hard work on this! Much appreciated! |
This is very exciting. Thanks so much Mark! |
Picking up from #226, I've adapted most style changes:
requires discussion with @yangshun @endiliey
RSK has a few redirects here, any thoughts how we implement these?
edit: tag the correct yangshun