package components import ( "github.com/LazyBachelor/LazyPM/internal/models" "github.com/LazyBachelor/LazyPM/pkg/web/components/base" ) type CommentSectionProps struct { IssueID string Comments []models.Comment } templ CommentSection(props CommentSectionProps) {

Comments

if len(props.Comments) == 0 {

No comments yet. Be the first to comment!

} else { for _, comment := range props.Comments { @CommentItem(CommentItemProps{Comment: comment}) } }
@CommentForm(CommentFormProps{ IssueID: props.IssueID, })
} type CommentListProps struct { Comments []models.Comment } templ CommentList(props CommentListProps) { if len(props.Comments) == 0 {

No comments yet. Be the first to comment!

} else { for _, comment := range props.Comments { @CommentItem(CommentItemProps{Comment: comment}) } } } type CommentItemProps struct { Comment models.Comment } templ CommentItem(props CommentItemProps) {
{ props.Comment.Author } { props.Comment.CreatedAt.Format("Jan 2, 2006 3:04 PM") }

{ props.Comment.Text }

} type CommentFormProps struct { IssueID string Author string Text string Class string } templ CommentForm(props CommentFormProps) {

Add a Comment

@base.Input(base.InputProps{ Name: "author", Label: "Your Name", Value: props.Author, Placeholder: "Enter your name", Class: "w-full", Required: true, }) @base.Textarea(base.TextareaProps{ Name: "text", Label: "Comment", Value: props.Text, Placeholder: "Write your comment here...", Class: "w-full", Required: true, Rows: 4, })
}