-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
* chore: clean up * chore: tmp variables * chore: basic style * test: Update snapshot
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Comment | ||
|
||
|
||
<code src="../examples/Comment.tsx" /> |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React, { useState, createElement } from 'react'; | ||
import { DislikeFilled, DislikeOutlined, LikeFilled, LikeOutlined } from '@ant-design/icons'; | ||
import { Avatar, Tooltip } from 'antd'; | ||
import { Comment } from '../../src'; | ||
|
||
import { presetPalettes } from '@ant-design/colors' | ||
console.log(presetPalettes); | ||
|
||
|
||
const lines = []; | ||
Object.keys(presetPalettes).forEach((key) => { | ||
for (let i = 0; i < 10; i += 1) { | ||
lines.push(`@${key}-${i + 1}: ${presetPalettes[key][i]};`); | ||
} | ||
}); | ||
|
||
console.log(lines.join('\n')); | ||
|
||
const App: React.FC = () => { | ||
const [likes, setLikes] = useState(0); | ||
const [dislikes, setDislikes] = useState(0); | ||
const [action, setAction] = useState<string | null>(null); | ||
|
||
const like = () => { | ||
setLikes(1); | ||
setDislikes(0); | ||
setAction('liked'); | ||
}; | ||
|
||
const dislike = () => { | ||
setLikes(0); | ||
setDislikes(1); | ||
setAction('disliked'); | ||
}; | ||
|
||
const actions = [ | ||
<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>, | ||
]; | ||
|
||
return ( | ||
<Comment | ||
actions={actions} | ||
author={<a>Han Solo</a>} | ||
avatar={<Avatar src="https://joeschmoe.io/api/v1/random" alt="Han Solo" />} | ||
content={ | ||
<p> | ||
We supply a series of design principles, practical patterns and high quality design | ||
resources (Sketch and Axure), to help people create their product prototypes beautifully | ||
and efficiently. | ||
</p> | ||
} | ||
datetime={ | ||
<Tooltip title="2016-11-22 11:22:33"> | ||
<span>8 hours ago</span> | ||
</Tooltip> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default App; |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
620ed65
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.
Successfully deployed to the following URLs:
compatible – ./
compatible-nine.vercel.app
compatible-git-master-pro-components.vercel.app
compatible-pro-components.vercel.app