The render
method returns a React Virtual DOM element. This code looks
like HTML, but don’t be fooled. The CJSX preprocessor converts
<a href="http://facebook.github.io/react/">Hello!</a>
into Javascript objects which describe the HTML you want:
React.createElement('a', {href: 'http://facebook.github.io/react/'}, 'Hello!')
We’re rendering a Popover
with a Menu
inside. These components are part
of Edgehill’s standard nylas-component-kit
library, and make it easy to build
interfaces that match the rest of Edgehill’s UI.
render: =>
React.createElement(Popover, {"ref": "popover", \
"className": "translate-language-picker pull-right", \
"buttonComponent": (@_renderButton())},
React.createElement(Menu, {"items": ( Object.keys(YandexLanguages) ), \
"itemKey": ( (item) -> item ), \
"itemContent": ( (item) -> item ), \
"onSelect": (@_onTranslate)
})
)