namht94's picture
quá đẹp, cho anh thêm example về màn hình login & table theo syle này nữa nha
90e733d verified
class CustomBotList extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.bot-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.bot-card {
background: rgba(15, 17, 21, 0.8);
border: 1px solid #4a5568;
padding: 0.75rem;
position: relative;
}
.bot-card.online {
border-left: 2px solid #ff9f1c;
}
.bot-card.offline {
opacity: 0.5;
}
.bot-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.bot-name {
font-size: 0.875rem;
font-weight: 600;
color: #ff9f1c;
}
.bot-status {
font-size: 0.75rem;
text-transform: uppercase;
}
.status-online {
color: #ff9f1c;
animation: pulse-amber 2s infinite;
}
.status-offline {
color: #4a5568;
}
.health-gauge {
display: flex;
gap: 1px;
margin: 0.5rem 0;
}
.gauge-segment {
height: 6px;
flex: 1;
background: #4a5568;
}
.gauge-segment.active {
background: #ff9f1c;
}
.gauge-segment.warning {
background: #dc2626;
}
.bot-actions {
display: flex;
gap: 0.5rem;
margin-top: 0.5rem;
}
.action-btn {
background: transparent;
border: 1px solid #4a5568;
color: #4a5568;
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
cursor: pointer;
transition: all 0.3s ease;
}
.action-btn:hover {
border-color: #ff9f1c;
color: #ff9f1c;
}
@keyframes pulse-amber {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
</style>
<div class="bot-list">
<div class="bot-card online">
<div class="bot-header">
<span class="bot-name">ALPHA-WOLF</span>
<span class="bot-status status-online">[ONLINE]</span>
</div>
<div class="health-gauge">
${Array(10).fill().map((_, i) =>
`<div class="gauge-segment ${i < 8 ? 'active' : ''}"></div>`
).join('')}
</div>
<div class="bot-actions">
<button class="action-btn">SLEEP</button>
<button class="action-btn">SCAN</button>
</div>
</div>
<div class="bot-card online">
<div class="bot-header">
<span class="bot-name">GHOST-RIDER</span>
<span class="bot-status status-online">[ONLINE]</span>
</div>
<div class="health-gauge">
${Array(10).fill().map((_, i) =>
`<div class="gauge-segment ${i < 6 ? 'active' : ''}"></div>`
).join('')}
</div>
<div class="bot-actions">
<button class="action-btn">SLEEP</button>
<button class="action-btn">SCAN</button>
</div>
</div>
<div class="bot-card offline">
<div class="bot-header">
<span class="bot-name">ECHO-SENTINEL</span>
<span class="bot-status status-offline">[OFFLINE]</span>
</div>
<div class="health-gauge">
${Array(10).fill().map(() =>
`<div class="gauge-segment"></div>`
).join('')}
</div>
<div class="bot-actions">
<button class="action-btn">WAKE</button>
</div>
</div>
</div>
`;
}
}
customElements.define('custom-bot-list', CustomBotList);