socialsphere / components /sidebar-left.js
aothuat's picture
facebook clone
be29055 verified
class SidebarLeft extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
}
.menu-item {
display: flex;
align-items: center;
gap: 12px;
padding: 10px;
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
font-weight: 600;
color: #1c1e21;
}
.menu-item:hover { background-color: #e4e6eb; }
.icon-box {
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.section-title {
font-size: 17px;
color: #65676b;
font-weight: 600;
margin: 10px 10px 5px;
}
a { text-decoration: none; color: inherit; }
</style>
<div class="user-shortcut menu-item">
<img src="http://static.photos/people/40x40/99" style="width:36px; height:36px; border-radius:50%; object-fit:cover;">
<span>Current User</span>
</div>
<div class="section-title">Your Shortcuts</div>
<a href="#">
<div class="menu-item">
<div class="icon-box" style="background-color: #1877f2; color: white;">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle></svg>
</div>
<span>Friends</span>
</div>
</a>
<a href="#">
<div class="menu-item">
<div class="icon-box" style="background-color: #e4e6eb; color: #1877f2;">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>
</div>
<span>Groups</span>
</div>
</a>
<a href="#">
<div class="menu-item">
<div class="icon-box" style="background-color: #f02849; color: white;">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
</div>
<span>Favorites</span>
</div>
</a>
<a href="#">
<div class="menu-item">
<div class="icon-box" style="background-color: #2abba7; color: white;">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>
</div>
<span>Memories</span>
</div>
</a>
`;
}
}
customElements.define('app-sidebar-left', SidebarLeft);