-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feature/with react #355
Merged
Merged
Feature/with react #355
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
faf3409
starting with-react func
AndyOGo 616a057
added sass to demo build
AndyOGo 2531dc1
watch jsx to
AndyOGo ec220c6
added dasherize function
AndyOGo ead4cfa
also resolve jsx
AndyOGo 7236b1e
added replace for ENV
AndyOGo a11cace
imported dasherize
AndyOGo 27bed76
fixed with react import
AndyOGo a8209cc
added displayName
AndyOGo 7e08ca0
mostly finalized this func
AndyOGo 43ae22a
added doclet
AndyOGo 7eca5b0
fixed missing braces
AndyOGo 84ffbd6
added click event
AndyOGo fed0748
added pure option
AndyOGo a6ac0be
fixed typo
AndyOGo ae98adc
start adding prop blacklist
AndyOGo 11c3318
fixed env replacement broken for demos
AndyOGo d95a71e
fixed rollup can't build react exports
AndyOGo 9ca4d1a
start adding todo sample app
AndyOGo c6663ae
start adding footer
AndyOGo ed232dc
fixed 0 output
AndyOGo 740303c
start adding header
AndyOGo 110d27f
all-demos.js:8502 Uncaught TypeError: Cannot read property 'id' of un…
AndyOGo 28f70c6
improving autofocus on edit
AndyOGo aa677cc
just added some margin to make the footer completely visible
AndyOGo b8ee7d0
quickfixed input losing focus within ce
AndyOGo 9974270
start documentation
AndyOGo 8668f72
improved options
AndyOGo ada3123
removed log
AndyOGo 68f38b0
removed yet another log
AndyOGo d770bcb
improved focus hack
AndyOGo d9074ef
focus hack cleanup
AndyOGo 526e756
start adding styles
AndyOGo 7917322
improving styles
AndyOGo d5cb7eb
utilised completed state
AndyOGo 0246f4d
display input only on edit
AndyOGo 1b3be9a
improved layout
AndyOGo deab83b
moar layout
AndyOGo 52944eb
improved inputs
AndyOGo 43c6dd2
improved input styling
AndyOGo 7762d20
improving butons
AndyOGo f4c728a
fixed little typo
AndyOGo 385f444
return cancelled of fire
AndyOGo 99db53b
fixed custom event check
AndyOGo 8bf977b
start adding custom events to footer links
AndyOGo 54b6c52
try to add custom event to button
AndyOGo 07a28d4
use new custom events
AndyOGo 40309f3
fixed broken event of catching of withReact
AndyOGo 97cb3f8
added support for dashed custom events
AndyOGo 734998a
fixed layout for looong text
AndyOGo 7e3ff8a
fixed misisng gap
AndyOGo 3c06b60
enabled handling of footer links
AndyOGo f5dec3c
prevent default action
AndyOGo ef7aa43
updated docs
AndyOGo 9b9568f
added todo
AndyOGo 5e66522
made the logo clickable
AndyOGo acdd32b
only re-render components, if their props have changed
AndyOGo 2d7ab94
added shouldComponentUpdate to base component's re-render
AndyOGo d7c71d3
added docs for should component update
AndyOGo 03b5231
removed the input hack
AndyOGo 405b19f
renamed to shouldUpdateCallback
AndyOGo 2397c93
adding array partition reducer
AndyOGo c770d6a
start adding batch props for integrations
AndyOGo a9422a3
improved FOUC by batch processing of props
AndyOGo 804617a
added docs for batch props
AndyOGo 373c1f1
fixed initial attribute fetching
AndyOGo da1db52
added updateProp for batching
AndyOGo ef3a5d9
add some props changes
AndyOGo 55a307d
added doclet
AndyOGo 058151a
added active item to footer links
AndyOGo f9abf30
switched ghost not ghost for todo item completion
AndyOGo 6fe9a8e
renamed this private func
AndyOGo a1b1222
added todo help to footer
AndyOGo 6486549
improved docs of events
AndyOGo 1cc7a08
utilised peer deps for with react
AndyOGo 25f1f44
just a typo
AndyOGo 2b52339
React 14 should also work
AndyOGo df6c7a1
fixed missing context
AndyOGo 92bf445
start adding event doclets
AndyOGo 7dead93
moar doclets
AndyOGo 45f6370
add mobile menu react entry
e726f0c
use name prop
AndyOGo 02436e0
added function name utility
AndyOGo 284bc69
fixed IE broken func name prop
AndyOGo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import on from '../../../js/on'; | ||
import fire from '../../../js/fire'; | ||
|
||
/** | ||
* @fires Button#axa-click | ||
*/ | ||
class Button { | ||
static DEFAULTS = { | ||
button: '.js-button', | ||
}; | ||
|
||
constructor(wcNode, options = {}) { | ||
this.wcNode = wcNode; | ||
|
||
this.options = { | ||
...Button.DEFAULTS, | ||
...options, | ||
}; | ||
|
||
this.handleClick = this.handleClick.bind(this); | ||
|
||
this.init(); | ||
} | ||
|
||
init() { | ||
this.button = this.wcNode.querySelector(this.options.button); | ||
|
||
this.on(); | ||
} | ||
|
||
on() { | ||
this.off(); | ||
|
||
this.unClick = on(this.button, 'click', this.handleClick, { | ||
passive: false, | ||
}); | ||
} | ||
|
||
off() { | ||
if (this.unClick) { | ||
this.unClick(); | ||
} | ||
} | ||
|
||
handleClick(event) { | ||
/** | ||
* axa-click event. | ||
* | ||
* @event Button#axa-click | ||
* @type {null} | ||
*/ | ||
const cancelled = fire(this.wcNode, 'axa-click', null, { bubbles: true, cancelable: true, composed: true }); | ||
|
||
if (!cancelled) { | ||
event.preventDefault(); | ||
} | ||
} | ||
|
||
destroy() { | ||
this.off(); | ||
|
||
if (this.button) { | ||
delete this.button; | ||
} | ||
|
||
if (this.wcNode) { | ||
delete this.wcNode; | ||
} | ||
|
||
if (this.options) { | ||
delete this.options; | ||
} | ||
|
||
delete this.handleClick; | ||
} | ||
} | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import on from '../../../js/on'; | ||
import fire from '../../../js/fire'; | ||
|
||
/** | ||
* @fires HeaderLogo#axa-click | ||
*/ | ||
class HeaderLogo { | ||
static DEFAULTS = { | ||
link: '.js-header-logo__link', | ||
} | ||
|
||
constructor(wcNode, options = {}) { | ||
this.wcNode = wcNode; | ||
this.options = { | ||
...HeaderLogo.DEFAULTS, | ||
...options, | ||
}; | ||
|
||
this.handleClick = this.handleClick.bind(this); | ||
|
||
this.init(); | ||
} | ||
|
||
init() { | ||
this.link = this.wcNode.querySelector(this.options.link); | ||
|
||
this.on(); | ||
} | ||
|
||
on() { | ||
this.off(); | ||
|
||
this.unClick = on(this.link, 'click', this.handleClick, { passive: false }); | ||
} | ||
|
||
handleClick(event) { | ||
/** | ||
* axa-click event. | ||
* | ||
* @event HeaderLogo#axa-click | ||
* @type {null} | ||
*/ | ||
const cancelled = fire(this.wcNode, 'axa-click', null, { bubbles: true, cancelable: true, composed: true }); | ||
|
||
if (!cancelled) { | ||
event.preventDefault(); | ||
} | ||
} | ||
|
||
off() { | ||
if (this.unClick) { | ||
this.unClick(); | ||
} | ||
} | ||
|
||
destroy() { | ||
this.off(); | ||
|
||
delete this.link; | ||
delete this.wcNode; | ||
delete this.options; | ||
delete this.handleClick; | ||
} | ||
} | ||
|
||
export default HeaderLogo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<article> | ||
<article style="margin-bottom: 100px;"> | ||
<h1>Demo on how to pass a callback function:</h1> | ||
<div class="my-event-demo-react"></div> | ||
|
||
<h1>Demo TodoMVC:</h1> | ||
<div class="my-todo-demo-react"></div> | ||
</article> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@LucaMele
Passing the current item's data down to the custom event is possible 👍