Skip to content

Latest commit

 

History

History
316 lines (266 loc) · 5.01 KB

File metadata and controls

316 lines (266 loc) · 5.01 KB

GDB Comments Styling Guide

This guide explains how to customize the appearance of the GDB Comments system to match your website's design.

Available CSS Classes

Main Container

.gdb-comments-container {
    /* Main wrapper for the entire comments section */
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

Comment Form

.gdb-comment-form {
    /* Comment input form container */
    margin-bottom: 30px;
}

.gdb-name-input {
    /* Name input field */
    width: 200px;
    padding: 8px;
    margin-bottom: 10px;
}

.gdb-comment-input {
    /* Comment textarea */
    width: 100%;
    min-height: 100px;
    padding: 12px;
    margin-bottom: 10px;
}

.gdb-submit-button {
    /* Submit button */
    padding: 8px 16px;
    background: #007bff;
    color: white;
}

Comments Display

.gdb-comments-list {
    /* Container for all comments */
}

.gdb-comment {
    /* Individual comment container */
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.gdb-comment.reply {
    /* Nested reply comments */
    margin-left: 30px;
    border-left: 3px solid #007bff;
}

.gdb-comment-header {
    /* Comment metadata section */
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gdb-comment-username {
    /* Username display */
    font-weight: bold;
}

.gdb-comment-time {
    /* Timestamp display */
    color: #666;
}

.gdb-comment-text {
    /* Comment content */
    margin: 0;
    line-height: 1.5;
}

Reply System

.gdb-reply-button {
    /* Reply action button */
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
}

.gdb-reply-form {
    /* Reply input form */
    margin-left: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.gdb-button-group {
    /* Container for form buttons */
    display: flex;
    gap: 10px;
}

.gdb-cancel-button {
    /* Cancel reply button */
    background: #dc3545;
    color: white;
}

Theme Support

Light Theme (Default)

.gdb-comments-container {
    color: #333;
    background: #fff;
}

.gdb-comment {
    background: #f8f9fa;
}

Dark Theme

.gdb-comments-container.dark {
    color: #fff;
    background: #222;
}

.dark .gdb-comment {
    background: #333;
}

.dark .gdb-name-input,
.dark .gdb-comment-input {
    background: #333;
    color: #fff;
    border-color: #444;
}

.dark .gdb-comment-time {
    color: #aaa;
}

Customization Examples

Modern Style

.gdb-comment {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.gdb-submit-button {
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: bold;
    transition: background 0.2s;
}

.gdb-comment-input {
    border-radius: 8px;
    border: 2px solid #eee;
    transition: border-color 0.2s;
}

.gdb-comment-input:focus {
    border-color: #007bff;
    outline: none;
}

Minimal Style

.gdb-comment {
    border-bottom: 1px solid #eee;
    background: none;
    padding: 20px 0;
    margin: 0;
    border-radius: 0;
}

.gdb-comment.reply {
    border-left: none;
    padding-left: 20px;
    position: relative;
}

.gdb-comment.reply::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #eee;
}

Animated Elements

.gdb-comment {
    animation: fadeIn 0.3s ease-in-out;
}

.gdb-reply-form {
    animation: slideDown 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

Best Practices

  1. Responsive Design
@media (max-width: 768px) {
    .gdb-comment.reply {
        margin-left: 15px;
    }
    
    .gdb-name-input {
        width: 100%;
    }
}
  1. Accessibility
.gdb-comment-input:focus,
.gdb-name-input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.gdb-submit-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
  1. Print Styles
@media print {
    .gdb-comment-form {
        display: none;
    }
    
    .gdb-comment {
        break-inside: avoid;
        border: 1px solid #000;
    }
}

Integration with Popular Frameworks

Tailwind CSS

Add these classes to your components:

<div class="max-w-2xl mx-auto p-4">
    <div class="bg-white rounded-lg shadow p-6">
        <!-- Comments content -->
    </div>
</div>

Bootstrap

Add Bootstrap classes:

<div class="container">
    <div class="card">
        <div class="card-body">
            <!-- Comments content -->
        </div>
    </div>
</div>

For more examples and advanced customization options, check out the example implementations in the /examples directory.