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

Implement a react parser to handle the presets #1

Open
ATLAS2002 opened this issue Jan 14, 2024 · 4 comments
Open

Implement a react parser to handle the presets #1

ATLAS2002 opened this issue Jan 14, 2024 · 4 comments
Labels
core enhancement New feature or request hard help wanted Extra attention is needed JWOC

Comments

@ATLAS2002
Copy link
Owner

This is the current location of presets:

  • packages
    • react
      • src
        • presets

          glare.ts
          index.ts
          tilt.ts

Problem:

And each of these preset files have a default function, that handles all the logic for that preset. But these are tightly coupled with the react environment. If we implement these effects in other frameworks then we have to rewrite the implementation code again.

Solution:

Instead what we can do is, move the logic to a separate preset directory packages/react/src/preset >> packages/preset under the packages. And for each framework there will be a dedicated parser, which will take the output generated by the preset file. And do react specific things, like adding refs. Currently the preset file takes the user's configuration and returns a resonate function which handles the implementation, also the ref of the component that it is controlling along with a title, that we pass to the ResonateContainer.

Important points:

  • You can add the parser here: packages/react/src/core/parser.ts.
  • The preset folder needs to be shifted directly under the packages/.
  • Use typescript efficiently. Write readable and reusable types.
  • Avoid using document.querySelector() or useRef() inside the preset file. Add a method inside the useAPI hook react/src/hooks/api.ts, and use it to access the element in the resonate function.
  • Using best react practices will be highly appreciated (that includes not using querySelectors, that directly access the DOM elements).

Please add a comment under this issue, if there is anything that you think would be better to add or change. Also I will be more than happy to guide you through the details, but I encourage taking a look at the code first. If there are any doubts not related to this issue you can ask them in the discord channel of JWOC.

That's all for this issue, good luck everyone & Happy Coding! 😄

@ATLAS2002 ATLAS2002 added enhancement New feature or request help wanted Extra attention is needed JWOC hard core labels Jan 14, 2024
@vermaanurag1532
Copy link

i have done alot of projects in react i can resolve this issue for you

@vermaanurag1532
Copy link

please Assign it to me

@ATLAS2002
Copy link
Owner Author

please Assign it to me

Mention JWOC while asking for being assigned. And please tell me what is your approach for this problem. Since this is a vital issue in the core functionality of the project, I'd like to discuss into details first before I assign it. You can describe it here or we can have a conversation in the discord channel about it.

@Anushkabh
Copy link

@ATLAS2002 I WANT TO WORK ON THIS ISSUE UNDER JWOC.. KINDLY ASSIGN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request hard help wanted Extra attention is needed JWOC
Projects
None yet
Development

No branches or pull requests

3 participants