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

Migrate Docs to Docusaurus 2 Alpha #226

Merged

Conversation

aswathkk
Copy link

@aswathkk aswathkk commented Oct 24, 2019

Live Preview:
https://redux-starter-kit.netlify.com/
Here are some screenshots:
Home
Quick Start

Issue
cc: @yangshun, @endiliey

Copy link

@endiliey endiliey left a comment

Choose a reason for hiding this comment

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

Please deploy it somewhere for easy demo.

@aswathkk
Copy link
Author

@endiliey Live preview is available at https://redux-starter-kit.netlify.com/

@markerikson
Copy link
Collaborator

As a first quick glance: looking at the Advanced Tutorial, the code block font seems smaller, and the diff-language blocks are not getting highlighted.

Copy link

@endiliey endiliey left a comment

Choose a reason for hiding this comment

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

I would recommend using different theme for the codeblock. eg: vsDark because the default one is palenight and the highlighting is very dependent on theme

https://v2.docusaurus.io/docs/markdown-features#syntax-highlighting

Maybe @markerikson can choose one. Or even build own theme it needed. Theme example: https://github.com/FormidableLabs/prism-react-renderer/tree/master/src/themes


function getTrackingScript() {
if (!siteConfig.gaTrackingId) {
return null

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

btw why do you need 404.js ? docusaurus handle it for you

Copy link
Author

Choose a reason for hiding this comment

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

Docusaurus is returning a blank content for 404. Don't know why.

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

But why https://redux-starter-kit.netlify.com/fdsafdsf is showing a blank content?
I tried removing src/pages/404.js also. But no use.

Copy link

@endiliey endiliey Oct 28, 2019

Choose a reason for hiding this comment

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

oh its because redux route basepath is empty so it routes to upper level docpage. Its equivalent to https://v2.docusaurus.io/docs

Choose a reason for hiding this comment

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

Did adding 404.js solve the issue though ?

Choose a reason for hiding this comment

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

This is fixed in next alpha release.

You can safely remove the 404.js here

Copy link
Author

@aswathkk aswathkk Oct 29, 2019

Choose a reason for hiding this comment

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

Adding 404.js did not resolve the issue.

oh its because redux route basepath is empty so it routes to upper level docpage. Its equivalent to https://v2.docusaurus.io/docs

Sorry. I didn't get this part.

Copy link

@endiliey endiliey Oct 29, 2019

Choose a reason for hiding this comment

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

It's a react router concept. You can ignore it for now.

But just to share knowledge

// routes.js
export default [
  {
    path: "/docs",
    component: ComponentCreator("/docs"),
    routes: [
      {
        path: "/docs/advanced-themes",
        component: ComponentCreator("/docs/advanced-themes"),
        exact: true
      },
      {
        path: "/docs/advanced-plugins",
        component: ComponentCreator("/docs/advanced-plugins"),
        exact: true
      },
    ]
  },
  {
    path: "*",
    component: ComponentCreator("*")
  }
];

imagine above scenario. Accessing /docs/xxxx will match /docs/

For redux case, it;s not /docs but / that's why you dont have 404 even if you access /xxxx/ its rendering the parent nested route

copyright: `Copyright (c) 2015-present Dan Abramov and the Redux documentation authors.`,
},
image: 'img/redux-logo-landscape.png',
twitterImage: 'img/redux-logo-twitter.png',

Choose a reason for hiding this comment

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

does this exist ? i dont think so

@endiliey
Copy link

endiliey commented Oct 27, 2019

Regarding the font size and the diff not showing any color. It's mostly due to theme. The default theme we chose: Palenight has that problem.

Here's some comparison
Palenight
palenight

Dracula
dracula

vsDark
vsDark

</header>
<main>
{features && features.length && (
<section className={[styles.features, styles.lightBackground].join(' ')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

the lightBackground style here is breaking dark mode now

>
{image && (
<div className={`text--center ${styles.blockImage}`}>
<img
Copy link
Contributor

Choose a reason for hiding this comment

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

if we use <img src="link-to-img.svg" />, they won't be able to pick up colors and therefore will not adapt to dark theme here neither. Probably will need to change the implementation here.

--ifm-color-primary-light: #825AC2;
--ifm-color-primary-lighter: #9B7BCE;
--ifm-color-primary-lightest: #B49CDA;
}
Copy link
Contributor

@wgao19 wgao19 Oct 27, 2019

Choose a reason for hiding this comment

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

I believe you can add some more css here to address the styling issue raised by @markerikson

As a first quick glance: looking at the Advanced Tutorial, the code block font seems smaller, and the diff-language blocks are not getting highlighted.

The --ifm-font-size-base defaults to 15px from Infima, the underlying CSS framework that Docusaurus 2 uses. Where the base font size in the current RSK site is 16px.

Although, directly changing it to 16px causes some of the navbar item to wrap text. So you may need to tweak there a little bit.

image

Also the default --ifm-code-font-size is 85% which causes the code block to become smaller.

image

Meanwhile, the classes in the diff language blocks are properly picked up, but there's no styling. This also can be fixed by adding some custom styling -- just some quick thoughts, there can be plugins / themes that already pick this up.

image

Edit: And yah, like @endiliey already points out, the palenight theme doesn't pick up the diff code block, maybe we can use another theme?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we're currently using Monokai as the syntax highlighting theme.

@aswathkk
Copy link
Author

@markerikson Can we use vsDark as the syntax highlighting theme?

@markerikson
Copy link
Collaborator

@aswathkk : I'd really prefer to stick with Monokai.

So where does this PR stand overall at this point?

@wgao19
Copy link
Contributor

wgao19 commented Nov 5, 2019

hey @markerikson seems there hasn't been much updates for a week, is it possible that we merge this PR to an intermediate branch at RSK then we (as Docusaurus maintainers) can work on top of that?

Perhaps it is because monokai is not an available theme by prism-react-renderer that Docusaurus 2 uses, but i guess we can convert this.

Looks to me we're mainly missing customized styling at this point.

@markerikson
Copy link
Collaborator

Given that there's a docs preview here, do we actually need a separate branch?

@yangshun
Copy link

yangshun commented Nov 5, 2019

Agree with @wgao19's approach. I think we need a separate branch so master can still keep the existing docs website and changes can be made to it.

@endiliey
Copy link

endiliey commented Nov 5, 2019

Given that there's a docs preview here, do we actually need a separate branch?

I think the main idea here is to let the maintainer of Docusaurus to continue @aswathkk (not a maintainer) work on the migration.

Given that this PR isn't really ready yet, its not a good idea to push this to master.
If we were to send another PR to RSK that supersedes this PR, that won't be nice to aswathkk since he has put lot of effort into this PR.
The concern here is that the migration has take a while and rounds of reviews is gonna put things more delayed

On another note deploy preview isn't working because the build directory has changed in v2. I recommend using a netlify config like CRA so that not only those who have access to RSK netlify.com setting can modify it.

Normally you had to modify it in netlify.com
image

But it's better to have it like this
https://github.com/facebook/create-react-app/blob/master/netlify.toml

Edit: ref https://v2.docusaurus.io/docs/migrating-from-v1-to-v2#update-references-to-the-build-directory

@markerikson markerikson changed the base branch from master to docusaurus-v2-integration November 5, 2019 05:59
@markerikson
Copy link
Collaborator

markerikson commented Nov 5, 2019

Okay, just created a docusaurus-v2-integration branch.

Looks like there's conflicts from my recent changes to the tutorials. Fix those and we can merge this into the integration branch.

Can that Netlify file be added on this branch, or does it need to be in master first?

@aswathkk
Copy link
Author

aswathkk commented Nov 6, 2019

@markerikson I've resolved the conflicts.

@markerikson
Copy link
Collaborator

markerikson commented Nov 6, 2019

It's failing to build atm, but yeah, let's go ahead and get this into the integration branch.

Thanks for the work on this!

@markerikson markerikson merged commit 160be2b into reduxjs:docusaurus-v2-integration Nov 6, 2019
markerikson pushed a commit that referenced this pull request Nov 19, 2019
* Migrate Docs to Docusaurus 2 Alpha (#226)

* Migrate to docusaurus 2

* Change docs to MDX format

* Make custom 404 compatible with Docusaurus v2

* Removes unwated stuffs as suggested by @endiliey

* update doc site .gitignore for Docusaurus 2

* update dependencies for Docusaurus 2

* remove lightBackground class that breaks dark mode

* inline svgs to pick up colors by dark theme

* make font size align with current RSK site

* use monokai css for code block

* remove unused files

* add netlify.toml

* remove unused 404 file

* move monokai into custom.css

* Update docusaurus, rm -rf useless file  & use correct monokai prism theme instead of css"

Co-authored-by: Endi <endiliey@gmail.com>

* tweak css

* tweak codeblock, use line highlighting

* line highlight docs

* readme

* tweaks

* tweak monokai

* larger code font

* workaround for highlighting toc

* bold right toc

* align inline code snippet style with current rsk site

- border radius should be 3px
- bg color should be rgba(27, 31, 35, 0.05)

* align anchor color with current rsk site

- anchor color should be blue
- visited color should be redux purple

* align pagination pill styles with current rsk site

- outline and link colors should be redux purple
- hover effect flips color and bg

* disable dark mode
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.

5 participants