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

[Doc] Automatically convert TS examples to JS #9005

Merged
merged 6 commits into from
Jun 16, 2023
Merged

[Doc] Automatically convert TS examples to JS #9005

merged 6 commits into from
Jun 16, 2023

Conversation

djhi
Copy link
Contributor

@djhi djhi commented Jun 14, 2023

Done client side and only when needed.
I compared locally with the previous docs and didn't notice any difference even with CPU throttling x6 on slow 3G

How to test

  • Open AccordionForm.md
  • Click on the AccordionForm.Panel section
  • Scroll down
  • The first snippet is bi-lingual
image

@djhi djhi added the RFR Ready For Review label Jun 14, 2023
@fzaninotto
Copy link
Member

When I click on a language tab, the screen "jumps". Can we avoid that?

@fzaninotto
Copy link
Member

Also, it seems the indentation differs between JS and TS. Can we make it consistent?

@djhi
Copy link
Contributor Author

djhi commented Jun 14, 2023

When I click on a language tab, the screen "jumps". Can we avoid that?

I don't see how. This is because we often have more code in TS

@djhi
Copy link
Contributor Author

djhi commented Jun 14, 2023

Also, it seems the indentation differs between JS and TS. Can we make it consistent?

I'm afraid we have inconsistent indentation everywhere so we'd have to apply the same everywhere as well

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

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

Code seems good.

BUT, I saw 2 issues:

  • Once you switch to TSX, all JSX code snippets disappear! (it can be seen in AccordionForm.md)
  • New lines are not preserved when they are in the JSX code. Example in the code below taken from Tutorial.md:
// in src/App.tsx
import { Admin, Resource, ListGuesser, EditGuesser, ShowGuesser } from 'react-admin';
import { dataProvider } from './dataProvider';

export const App = () => (
    <Admin dataProvider={dataProvider}>

    </Admin>
);

The new lines between <Admin> and </Admin> are not preserved.

.language-switcher.active {
background-color: #f5f2f0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you rename this file to style-v18?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed with Francois, it's actually unnecessary. @fzaninotto Did I get that right?

docs/js/ra-doc-exec.js Outdated Show resolved Hide resolved
@slax57 slax57 requested a review from fzaninotto June 15, 2023 15:51
@slax57
Copy link
Contributor

slax57 commented Jun 15, 2023

@fzaninotto I'll let you check one last time 😉

@fzaninotto fzaninotto merged commit 2a53f9c into master Jun 16, 2023
3 of 4 checks passed
@fzaninotto fzaninotto deleted the ts-docs branch June 16, 2023 07:56
@fzaninotto fzaninotto added this to the 4.11.3 milestone Jun 16, 2023
@slax57 slax57 changed the title Automatically convert TS examples to JS [Doc] Automatically convert TS examples to JS Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants