Browse Source

add flex styles, make filename full-width

integrate-editor
bat 3 years ago
parent
commit
d6e1c8998d
  1. 37
      index.html

37
index.html

@ -1,3 +1,16 @@
<style>
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
display: flex;
flex-direction: column;
align-items: stretch;
}
</style>
<script type="module"> <script type="module">
class FileGroup extends HTMLElement { class FileGroup extends HTMLElement {
constructor() { constructor() {
@ -15,8 +28,11 @@ class FileGroup extends HTMLElement {
:host { :host {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: stretch;
} }
div.header { div.header {
display: flex;
flex-direction: row;
} }
div.files { div.files {
display: flex; display: flex;
@ -39,19 +55,34 @@ class FileView extends HTMLElement {
constructor() { constructor() {
super() super()
this.attachShadow({mode: 'open'}) this.attachShadow({mode: 'open'})
this.headerEl = document.createElement('div')
this.headerEl.classList.add('header')
this.contentEl = document.createElement('div')
this.shadowRoot.appendChild(this.headerEl)
this.shadowRoot.appendChild(this.contentEl)
} }
connectedCallback() { connectedCallback() {
const style = document.createElement('style') const style = document.createElement('style')
style.textContent = ` style.textContent = `
:host { :host {
height: 100px; display: flex;
background: #777; flex-direction: column;
align-items: stretch;
}
div.header {
display: flex;
flex-direction: row;
background: yellow;
}
.name {
flex-grow: 1;
} }
` `
this.shadowRoot.appendChild(style) this.shadowRoot.appendChild(style)
this.nameEl = document.createElement('input') this.nameEl = document.createElement('input')
this.shadowRoot.appendChild(this.nameEl) this.nameEl.classList.add('name')
this.headerEl.appendChild(this.nameEl)
} }
} }

Loading…
Cancel
Save