Show HN: A React.js yearly calendar component
github.com
github.com
I once created a ColdFusion (anyone remember CFML?) module for rendering similar calendar layout on server side.
Basically we needed it for a project where we had to display how an year was subdivided into 4 different periods. Here we also highlighted the working, festive and prefestive days.
I think it turned out to be an interesting layout, you can see it here: http://postimg.org/image/4yqaywm2r/.
https://facebook.github.io/react/downloads.html (the note under npm section)
https://github.com/facebook/react/issues/1772
http://stackoverflow.com/questions/22118915/how-to-turn-on-o...
The same shouldComponentUpdate optimization could be added to both Calendar and Day, but in this case clicking a Day would always require the Calendar to re-render, and running through 365 shouldComponentUpdate functions (returning false from at least 363 of them) without first limiting by Month would not be ideal.
If the state is managed with ImmutableJS or a similar library, shouldComponentUpdate would only have to do a single reference equality check. Either way you should see a big improvement from any implementation that allows the individual Month components to skip rendering:
http://facebook.github.io/react/docs/advanced-performance.ht...
With the main bottleneck being here: https://github.com/BelkaLab/react-yearly-calendar/blob/maste...
Implementing a good shouldComponentUpdate() should fix it.
I'll have a go myself when I get home, if I'm successful I'll submit a pull request.
Feel free to submit a pull request then! I just kindly ask you if you could use airbnb's Javascript and React style guides, that is a pretty good standard IMHO https://github.com/airbnb/javascript/tree/master/react
A different approach could be to pass a `classScope` string props down to the components, and each component then applies it to the classes it uses (Example: return (<div className={this.props.classScope + "inner-div"}></div>); ). This way we could achieve better css selector scoping, at a cost of a slightly more verbose code when using a component.
You could also just not do inline styles, it isn't required.
1. This is a fork from Hanse Kristian, who doesn't appear to work for your company. That is, it doesn't look like BelkaLab did anything but change package.json to name itself as the author.
2. It's a bit confusing why you put the generated demo.js file as part of the repository and have npm (.npmignore) ignore the src files. Is there something special about this demo.js file instead of it being browserify output?
Side comment: I was expecting some sort of a 'marketplace' to emerge for react components. I am surprised by so few reusable react components.
Its an innovative calendar layout and while I don't know if I would use it in time / data selection, in terms of visualizing data inside of a year it has a lot of potential.
Thanks for your kind words anyway! :)
I don't see what's wrong here: every company in the IT world releases open source components: Django, Bootstrap, Foundation and React itself are open source projects backed by companies. But there's also smaller things being released every day, and each of them contributes to the great world of open source.
We use open source, we give back to the open source community. We are giving away our time for free releasing a component, I don't see anything bad adding a small link to our website.
And that is even without that contextual information that you've noted.
> Show HN is for something you've made that other people can play with. HN users can try it out, give you feedback, and ask questions in the thread.
https://news.ycombinator.com/showhn.html
There is nothing even remotely inappropriate being done here, except for your comment, which violates the self-same rules:
> Be respectful. Anyone sharing work is making a contribution, however modest.
Either way, your parade of horribles is unlikely to occur, or be that horrible if it were. To each their own though.
I just wanted to share this, I think some people disagree with you if I am in homepage right now