mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 02:56:22 +00:00
feat: 更新评论输入框的占位符,支持自定义占位符文本
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 27s
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 27s
This commit is contained in:
@ -16,12 +16,14 @@ export function CommentInput(
|
|||||||
onCommentSubmitted,
|
onCommentSubmitted,
|
||||||
initContent = "",
|
initContent = "",
|
||||||
initIsPrivate = false,
|
initIsPrivate = false,
|
||||||
|
placeholder = "",
|
||||||
isUpdate = false
|
isUpdate = false
|
||||||
}: {
|
}: {
|
||||||
user: User | null,
|
user: User | null,
|
||||||
onCommentSubmitted: ({ commentContent, isPrivate }: { commentContent: string, isPrivate: boolean }) => void,
|
onCommentSubmitted: ({ commentContent, isPrivate }: { commentContent: string, isPrivate: boolean }) => void,
|
||||||
initContent?: string,
|
initContent?: string,
|
||||||
initIsPrivate?: boolean,
|
initIsPrivate?: boolean,
|
||||||
|
placeholder?: string,
|
||||||
isUpdate?: boolean,
|
isUpdate?: boolean,
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
@ -65,7 +67,7 @@ export function CommentInput(
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex-1 pl-2 fade-in-up">
|
<div className="flex-1 pl-2 fade-in-up">
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder={user ? (isPrivate ? t("private_placeholder") : t("placeholder")) : t("login_required", { loginButton: "登录" })}
|
placeholder={placeholder || (user ? (isPrivate ? t("private_placeholder") : t("placeholder")) : t("login_required", { loginButton: "登录" }))}
|
||||||
className="w-full p-2 border border-gray-300 rounded-md fade-in-up"
|
className="w-full p-2 border border-gray-300 rounded-md fade-in-up"
|
||||||
value={commentContent}
|
value={commentContent}
|
||||||
onChange={(e) => setCommentContent(e.target.value)}
|
onChange={(e) => setCommentContent(e.target.value)}
|
||||||
|
@ -268,6 +268,7 @@ export function CommentItem(
|
|||||||
user={user}
|
user={user}
|
||||||
onCommentSubmitted={onReply}
|
onCommentSubmitted={onReply}
|
||||||
initIsPrivate={isPrivate}
|
initIsPrivate={isPrivate}
|
||||||
|
placeholder={`${t("reply")} ${comment.user.nickname} :`}
|
||||||
/>}
|
/>}
|
||||||
{activeInput && activeInput.type === 'edit' && activeInput.id === comment.id && <CommentInput
|
{activeInput && activeInput.type === 'edit' && activeInput.id === comment.id && <CommentInput
|
||||||
user={user}
|
user={user}
|
||||||
|
Reference in New Issue
Block a user