:sparkly: Add react-json-view in recommendation

This commit is contained in:
afc163 2019-03-12 14:26:41 +08:00
parent 43b13f6f73
commit f65853b2b1
No known key found for this signature in database
GPG Key ID: 738F973FCE5C6B48
3 changed files with 19 additions and 6 deletions

View File

@ -12,6 +12,7 @@ Layout | [@rebass/grid](https://github.com/rebassjs/grid) [react-blocks](http://
Drag and drop | [react-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd/) [react-dnd](https://github.com/gaearon/react-dnd) [react-sortable-hoc](https://github.com/clauderic/react-sortable-hoc)
Code Editor | [react-codemirror2](https://github.com/scniro/react-codemirror2) [react-monaco-editor](https://github.com/superRaytin/react-monaco-editor)
Rich Text Editor | [react-quill](https://github.com/zenoamaro/react-quill) [braft-editor](https://github.com/margox/braft-editor)
JSON Viewer | [react-json-view](https://github.com/mac-s-g/react-json-view)
Color Picker | [rc-color-picker](https://github.com/react-component/color-picker) [react-color](http://casesandberg.github.io/react-color/)
Media Query | [react-responsive](https://github.com/contra/react-responsive) [react-media](https://github.com/ReactTraining/react-media)
Copy to clipboard | [react-copy-to-clipboard](https://github.com/nkbt/react-copy-to-clipboard)

View File

@ -12,6 +12,7 @@ title: 社区精选组件
拖拽 | [react-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd/) [react-dnd](https://github.com/gaearon/react-dnd) [react-sortable-hoc](https://github.com/clauderic/react-sortable-hoc)
代码编辑器 | [react-codemirror2](https://github.com/scniro/react-codemirror2) [react-monaco-editor](https://github.com/superRaytin/react-monaco-editor)
富文本编辑器 | [react-quill](https://github.com/zenoamaro/react-quill) [braft-editor](https://github.com/margox/braft-editor)
JSON 显示器 | [react-json-view](https://github.com/mac-s-g/react-json-view)
拾色器 | [rc-color-picker](https://github.com/react-component/color-picker) [react-color](http://casesandberg.github.io/react-color/)
响应式 | [react-responsive](https://github.com/contra/react-responsive) [react-media](https://github.com/ReactTraining/react-media)
复制到剪贴板 | [react-copy-to-clipboard](https://github.com/nkbt/react-copy-to-clipboard)

View File

@ -37,14 +37,25 @@ export default class Article extends React.Component {
}
onResourceClick = e => {
const cardNode = e.target.closest('.resource-card');
if (!window.gtag || !cardNode) {
if (!window.gtag) {
return;
}
const cardNode = e.target.closest('.resource-card');
if (cardNode) {
window.gtag('event', 'resource', {
event_category: 'Download',
event_label: cardNode.href,
});
}
if (
window.location.href.indexOf('docs/react/recommendation') > 0 &&
e.target.matches('.markdown > table td > a[href]')
) {
window.gtag('event', 'recommendation', {
event_category: 'Click',
event_label: e.target.href,
});
}
};
getArticle(article) {