File size: 4,255 Bytes
7e144db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | class EditorSidebar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
aside {
width: 250px;
background: white;
padding: 1rem;
height: 100%;
overflow-y: auto;
border-right: 1px solid #fbcfe8;
}
h3 {
font-size: 1rem;
font-weight: 600;
color: #831843;
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid #fbcfe8;
}
.section {
margin-bottom: 1.5rem;
}
.character-list, .background-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.character-item, .background-item {
display: flex;
align-items: center;
padding: 0.5rem;
border-radius: 0.25rem;
cursor: pointer;
font-size: 0.875rem;
}
.character-item:hover, .background-item:hover {
background-color: #fce7f3;
}
.character-color {
width: 16px;
height: 16px;
border-radius: 50%;
margin-right: 0.5rem;
}
.add-button {
display: flex;
align-items: center;
gap: 0.25rem;
color: #be185d;
font-size: 0.875rem;
margin-top: 0.5rem;
cursor: pointer;
}
.add-button i {
width: 16px;
height: 16px;
}
</style>
<aside>
<div class="section">
<h3>Characters</h3>
<div class="character-list" id="character-list">
<div class="character-item">
<div class="character-color" style="background-color: #ec4899;"></div>
<span>Aoi</span>
</div>
<div class="character-item">
<div class="character-color" style="background-color: #3b82f6;"></div>
<span>Haru</span>
</div>
</div>
<div class="add-button">
<i data-feather="plus"></i>
<span>Add Character</span>
</div>
</div>
<div class="section">
<h3>Backgrounds</h3>
<div class="background-list" id="background-list">
<div class="background-item">park_day</div>
<div class="background-item">cafe</div>
</div>
<div class="add-button">
<i data-feather="plus"></i>
<span>Add Background</span>
</div>
</div>
<div class="section">
<h3>Scenes</h3>
<div class="background-list" id="scene-list">
<div class="background-item">start</div>
<div class="background-item">next_scene</div>
</div>
<div class="add-button">
<i data-feather="plus"></i>
<span>Add Scene</span>
</div>
</div>
</aside>
`;
if (window.feather) {
this.shadowRoot.querySelectorAll('[data-feather]').forEach(el => {
feather.replace(el);
});
}
}
}
customElements.define('editor-sidebar', EditorSidebar); |