Browse Source

docs(comment): like and dislike number event binding #25437 (#25444)

* fix(comment): like and dislike number cursor style(#25437)

* docs: modify like and dislike DOM order and onclick event binding

* fix: key missing for actions array

* fix: add test snapshot

* fix: modify test snapshot
pull/25432/head
zxyao 4 years ago
committed by GitHub
parent
commit
b06e2567b6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      components/comment/__tests__/__snapshots__/demo.test.js.snap
  2. 28
      components/comment/demo/basic.md

2
components/comment/__tests__/__snapshots__/demo.test.js.snap

@ -56,7 +56,6 @@ exports[`renders ./components/comment/demo/basic.md correctly 1`] = `
aria-label="like"
class="anticon anticon-like"
role="img"
tabindex="-1"
>
<svg
aria-hidden="true"
@ -86,7 +85,6 @@ exports[`renders ./components/comment/demo/basic.md correctly 1`] = `
aria-label="dislike"
class="anticon anticon-dislike"
role="img"
tabindex="-1"
>
<svg
aria-hidden="true"

28
components/comment/demo/basic.md

@ -37,22 +37,18 @@ const Demo = () => {
};
const actions = [
<span key="comment-basic-like">
<Tooltip title="Like">
{createElement(action === 'liked' ? LikeFilled : LikeOutlined, {
onClick: like,
})}
</Tooltip>
<span className="comment-action">{likes}</span>
</span>,
<span key="comment-basic-dislike">
<Tooltip title="Dislike">
{React.createElement(action === 'disliked' ? DislikeFilled : DislikeOutlined, {
onClick: dislike,
})}
</Tooltip>
<span className="comment-action">{dislikes}</span>
</span>,
<Tooltip key="comment-basic-like" title="Like">
<span onClick={like}>
{createElement(action === 'liked' ? LikeFilled : LikeOutlined)}
<span className="comment-action">{likes}</span>
</span>
</Tooltip>,
<Tooltip key="comment-basic-dislike" title="Dislike">
<span onClick={dislike}>
{React.createElement(action === 'disliked' ? DislikeFilled : DislikeOutlined)}
<span className="comment-action">{dislikes}</span>
</span>
</Tooltip>,
<span key="comment-basic-reply-to">Reply to</span>,
];

Loading…
Cancel
Save