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

issue/2824-jsx JSX version of accordion #97

Closed
wants to merge 22 commits into from
Closed

Conversation

oliverfoster
Copy link
Member

@oliverfoster oliverfoster commented Jul 8, 2020

issue/2824-react

part of adaptlearning/adapt_framework#2876

An example of how to create a react version of a component:

  1. ViewClass.template = 'name.jsx'; Add .jsx to the end of the template name (Template names are sometimes implied from the Adapt.register call).
  2. Convert the hbs template into a jsx template, the jsx template should reflect all of the view states, including any DOM modifications from the javascript.
  3. Remove all of the DOM modifications from the javascript (in the case of the accordion below, jquery still handles the animation)

This is called a declarative approach, where we declare the state of the DOM in jsx and allow the computer to figure out how to implement it. We have been using an imperative approach, where we have to tell the computer how to make DOM modifications. Reference on declarative vs imperative

@oliverfoster
Copy link
Member Author

I think we could probably do the event attachment both ways @cahirodoherty-learningpool
I'm not sure which is easier to understand.
Attachment by the callback onClick or attachment where the click happens?

@cahirodoherty-learningpool
Copy link
Contributor

I think we could probably do the event attachment both ways @cahirodoherty-learningpool
I'm not sure which is easier to understand.
Attachment by the callback onClick or attachment where the click happens?

Yeh I'm not sure which is the best way to declare this, but happy with either as long as there is consistency across views.

@oliverfoster
Copy link
Member Author

I think if we step away from backbone for the events that'd be the best long-term plan.

@oliverfoster
Copy link
Member Author

Does it all make sense otherwise?

Copy link
Contributor

Choose a reason for hiding this comment

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

👀

@NayanKhedkar
Copy link
Member

NayanKhedkar commented Jul 14, 2020

@oliverfoster can we get rid of var most of the(one time assigned) variables to const now
e.g.
var isResetOnRevisit = this.model.get('_isResetOnRevisit');
var index = item.get('_index');

Copy link
Contributor

@moloko moloko left a comment

Choose a reason for hiding this comment

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

couple of minor suggestions, otherwise looking great. Bring it on!

js/accordionView.js Outdated Show resolved Hide resolved
js/accordionView.js Outdated Show resolved Hide resolved
@oliverfoster
Copy link
Member Author

oliverfoster commented Jul 16, 2020

Do not merge without adaptlearning/adapt_framework#2829 and adaptlearning/adapt_framework#2827 version bump accordingly when ready.

Notes:

  • Will need accessibility and general functionality testing.
  • May not work with some extensions that inject themselves into the DOM.

@oliverfoster oliverfoster added the on hold do not merge label Aug 3, 2020
@oliverfoster
Copy link
Member Author

@kineojen : could you double check the img loading=eager attribute when you next run this?

@ghost
Copy link

ghost commented Aug 17, 2020

@kineojen : could you double check the img loading=eager attribute when you next run this?

Confirmed all accordion images are set to loading="eager"

templates/accordion.jsx Outdated Show resolved Hide resolved
templates/accordion.jsx Outdated Show resolved Hide resolved
templates/accordion.jsx Outdated Show resolved Hide resolved
templates/accordion.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

@oliverfoster
Copy link
Member Author

Ready to review, requires pr#3140

@oliverfoster oliverfoster changed the title issue/2824-jsx React version of accordion issue/2824-jsx JSX version of accordion Aug 26, 2021
@oliverfoster oliverfoster deleted the issue/2824-jsx branch August 26, 2021 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants