data-alchemy-nexus / components /action-bar.js
Iboytech's picture
Find errors and fix it
81ca604 verified
Raw History Blame Contribute Delete
5.06 kB
class CustomActionBar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
position: fixed;
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
}
.action-bar {
background: rgba(17, 24, 39, 0.9);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 2rem;
padding: 0.75rem 1.5rem;
box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
gap: 0.75rem;
align-items: center;
}
.action-btn {
padding: 0.75rem;
border-radius: 1rem;
background: rgba(255, 255, 255, 0.05);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.action-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
transition: left 0.4s ease;
}
.action-btn:hover {
transform: translateY(-3px) scale(1.05);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}
.action-btn:hover::before {
left: 100%;
}
.action-btn.active {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(217, 70, 239, 0.2));
}
.tooltip {
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%) translateY(-10px);
background: rgba(16, 185, 129, 0.9);
color: white;
padding: 0.5rem 1rem;
border-radius: 0.75rem;
font-size: 0.875rem;
font-weight: 500;
white-space: nowrap;
opacity: 0;
transition: all 0.3s ease;
pointer-events: none;
}
.action-btn:hover .tooltip {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
@keyframes slideUpIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
</style>
<div class="action-bar glass-effect-enhanced">
<div class="magnetic-area">
<button class="action-btn magnetic-btn text-gray-300 hover:text-white">
<i data-feather="download" class="w-5 h-5"></i>
<span class="tooltip">Download Report</span>
</button>
</div>
<div class="magnetic-area">
<button class="action-btn magnetic-btn text-gray-300 hover:text-white">
<i data-feather="share-2" class="w-5 h-5"></i>
<span class="tooltip">Share Insights</span>
</button>
<div class="magnetic-area">
<button class="action-btn magnetic-btn text-gray-300 hover:text-white">
<i data-feather="bar-chart-2" class="w-5 h-5"></i>
<span class="tooltip">View Analytics</span>
</button>
<div class="magnetic-area">
<button class="action-btn magnetic-btn text-gray-300 hover:text-white">
<i data-feather="settings" class="w-5 h-5"></i>
<span class="tooltip">Settings</span>
</button>
</div>
`;
this.addButtonEffects();
}
addButtonEffects() {
const actionBtns = this.shadowRoot.querySelectorAll('.action-btn');
actionBtns.forEach(btn => {
btn.addEventListener('click', () => {
// Add active state animation
btn.classList.add('active');
setTimeout(() => {
btn.classList.remove('active');
}, 300);
});
});
}
}
customElements.define('custom-action-bar', CustomActionBar);