-
Notifications
You must be signed in to change notification settings - Fork 167
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
Modify Signals to render a HTML button without React. #148
Conversation
This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there: |
Can anyone help me understand why the PR is failing 2 Checks? |
This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/can-anyone-help-me-understand-why-my-pr-is-failing-2-checks/7932/1 |
Thanks @adpatter The errors come from the snippets in the README. To ensure the code and the README are aligned we are using a tool call embedme that copy the code snippets within the README. And in the CI, we are checking the code and snippets are aligned. To update the README, you need to execute More details - in the CI logs you can see:
So all snippets in the README needs to be updated except the one in lines 124-131. |
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.
@adpatter I added some comments and suggestions.
basics/signals/README.md
Outdated
this._stateChanged.emit(this._count); | ||
}); | ||
} | ||
//... | ||
} | ||
``` | ||
|
||
`ButtonWidget` also contain a private attribute `_count` of type `ICount`. |
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.
`ButtonWidget` also contain a private attribute `_count` of type `ICount`. | |
`ButtonWidget` also contains a private attribute `_count` of type `ICount`. |
Taking the chance to correct that one 😉
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.
Fixed as requested.
basics/signals/package.json
Outdated
"@lumino/disposable": "^1.4.3" | ||
"@lumino/disposable": "^1.4.3", | ||
"@lumino/signaling": "^1.3.3", | ||
"@lumino/widgets": "^1.3.3" |
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.
"@lumino/widgets": "^1.3.3" | |
"@lumino/widgets": "^1.16.1" |
Alignment with jupyterlab dependency constrain
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.
Fixed as requested. Thanks for the guidance.
basics/signals/package.json
Outdated
"@jupyterlab/application": "^3.0.0-rc.15", | ||
"@jupyterlab/apputils": "^3.0.3", | ||
"@jupyterlab/launcher": "^3.0.0-rc.15", | ||
"@jupyterlab/mainmenu": "^3.0.0-rc.15", | ||
"@jupyterlab/translation": "^3.0.0-rc.15", |
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.
"@jupyterlab/application": "^3.0.0-rc.15", | |
"@jupyterlab/apputils": "^3.0.3", | |
"@jupyterlab/launcher": "^3.0.0-rc.15", | |
"@jupyterlab/mainmenu": "^3.0.0-rc.15", | |
"@jupyterlab/translation": "^3.0.0-rc.15", | |
"@jupyterlab/application": "^3.0.3", | |
"@jupyterlab/apputils": "^3.0.3", | |
"@jupyterlab/launcher": "^3.0.3", | |
"@jupyterlab/mainmenu": "^3.0.3", | |
"@jupyterlab/translation": "^3.0.3", |
it is a good practice to be consistent on the jupyterlab dependencies.
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.
Fixed as requested.
/** | ||
* The class name added to console panels. | ||
*/ | ||
const PANEL_CLASS = 'jp-tutorial-view'; |
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.
Could you keep the class name as constant as this is to align with JupyterLab practice?
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.
Fixed as requested. However, I noticed that the documentation seemed to indicated that they were moving away from that practice: "CSS classnames are defined inline in the code. We used to put them as all caps file-level consts, but we are moving away from that." (https://jupyterlab.readthedocs.io/en/stable/developer/css.html)
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.
Thanks for pointing this out - I miss that information. I have opened a new issue to conform to that principle. So we can merge this one.
basics/signals/src/button.ts
Outdated
* The class name, jp-ButtonWidget, follows the CSS class naming | ||
* convention for classes that extend lumino.Widget. | ||
*/ | ||
this.addClass('jp-ButtonWidget'); |
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.
Could you extract the class name as constant to align with JupyterLab practice?
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.
Fixed as requested.
basics/signals/src/button.ts
Outdated
constructor(options = { node: document.createElement('button') }) { | ||
super(options); | ||
|
||
this.node.textContent = 'Clickme'; |
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.
What about
this.node.textContent = 'Clickme'; | |
this.node.textContent = 'Click me'; |
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.
Fixed as requested.
@fcollonval Thank you for reviewing my code and providing guidance. In particular, thank you for the guidance on how to choose dependency versions - it makes sense to me now. I made all of the requested corrections to the code. It looks like the PR has passed all the checks. Thank you. |
A .vscode file snuck in there, so I pushed again. |
@fcollonval It took me awhile to figure out how embedme works. However, I think I have all the mappings correct now - I apologize if this caused you any inconvenience. I will be more careful about the mappings in the future. Thank you. |
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.
LGTM ! Thanks @adpatter
This PR is in reference to #144.
Modify the Signals example to create an HTML button instead of a React button. I think this modification will make the documentation easier to follow for persons who don't know React.
Further, the Lumino Widgets were modified in order to produce the desired result shown in preview.png. The result of the current React implementation doesn't actually produce what is in the preview image.
CSS class naming conventions were followed.