dodey917's picture
Build a premium, futuristic, fully animated business website named “Nomarddesk” with a straight-line layout design (clean vertical sections stacked from top to bottom).
3fa7e5a verified
class ReviewCard extends HTMLElement {
connectedCallback() {
const name = this.getAttribute('name') || 'Anonymous';
const rating = parseInt(this.getAttribute('rating')) || 5;
const text = this.getAttribute('text') || 'Great service!';
const service = this.getAttribute('service') || 'Service';
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 0.75rem;
padding: 1.5rem;
margin: 1rem;
min-width: 300px;
transition: transform 0.3s ease;
}
:host:hover {
transform: translateY(-5px);
box-shadow: 0 20px 40px rgba(0, 255, 255, 0.2);
}
.review-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
.review-name {
font-weight: 600;
color: white;
}
.review-service {
font-size: 0.875rem;
color: #9ca3af;
}
.rating {
display: flex;
gap: 0.25rem;
}
.star {
filter: drop-shadow(0 0 3px #ffd700);
}
.review-text {
color: #e5e7eb;
margin-bottom: 0.5rem;
}
.review-date {
font-size: 0.875rem;
color: #6b7280;
}
</style>
<div class="review-card">
<div class="review-header">
<div>
<div class="review-name">${name}</div>
<div class="review-service">${service}</div>
</div>
<div class="rating">
${this.generateStars(rating)}
</div>
</div>
<div class="review-text">"${text}"</div>
<div class="review-date">${this.generateDate()}</div>
</div>
`;
}
generateStars(rating) {
let stars = '';
for (let i = 0; i < 5; i++) {
if (i < rating) {
stars += '<i data-feather="star" class="star" style="color: #ffd700; width: 16px; height: 16px;"></i>';
} else {
stars += '<i data-feather="star" style="color: #374151; width: 16px; height: 16px;"></i>';
}
}
return stars;
}
generateDate() {
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const date = new Date();
const month = months[date.getMonth()];
const year = date.getFullYear();
return `${month} ${year}`;
}
}
customElements.define('review-card', ReviewCard);