Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stub out unibox
  • Loading branch information
gordonbrander committed May 30, 2024
commit ae9265bb55275177f3c0f0f290bfcf393749e31f
9 changes: 5 additions & 4 deletions static/2024-05-30-app-skeleton-lit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@
<com-thread slot="main">
<com-thread-group>
<com-prompt slot="prompt">
Hello world
<com-editor value="Henlo world"></com-editor>
</com-prompt>
<com-response slot="response">
Henlo world
<com-editor value="Hello world"></com-editor>
</com-response>
</com-thread-group>
<com-thread-group>
<com-prompt slot="prompt">
Hello world
<com-editor value="Henlo world"></com-editor>
</com-prompt>
<com-response slot="response">
Henlo world
<com-editor value="Hello world"></com-editor>
</com-response>
</com-thread-group>
</com-thread>
<div slot="footer">
<com-unibox>
<com-editor slot="main"></com-editor>
<com-button slot="end">Send</com-button>
</com-unibox>
</div>
Expand Down
34 changes: 20 additions & 14 deletions static/2024-05-30-app-skeleton-lit/src/components/com-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,48 @@ import {base} from '../styles'
const styles = css`
:host {
display: block;
}

.layout {
display: grid;
grid-template-rows: 1fr min-content;
grid-template-areas:
"main"
"footer";
height: 100cqh;
height: 100cqh;
}

> com-chat-main {
grid-area: main;
overflow-y: auto;
overflow-x: hidden;
}
.main {
grid-area: main;
overflow-y: auto;
overflow-x: hidden;
padding: var(--gap);
}

> com-chat-footer {
grid-area: footer;
}
.footer {
grid-area: footer;
padding: 0 var(--gap) var(--gap);
}
`

@customElement('com-chat')
export class ComAppGrid extends LitElement {
export class ComChat extends LitElement {
static styles = [base, styles]

render() {
return html`
<com-chat-main>
<div class="layout">
<div class="main">
<com-content>
<slot name="main"></slot>
</com-content>
</com-chat-main>
<com-chat-footer>
</div>
<div class="footer">
<com-content>
<slot name="footer"></slot>
</com-content>
</com-chat-footer>
</div>
</div>
`
}
}
Expand Down
30 changes: 30 additions & 0 deletions static/2024-05-30-app-skeleton-lit/src/components/com-editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {LitElement, html, css} from 'lit-element'
import {customElement, property} from 'lit/decorators.js'
import {base} from '../styles'

const styles = css`
:host {
display: block;
}

.editor {
display: block;

&:focus {
outline: none;
}
}
`

@customElement('com-editor')
export class ComEditor extends LitElement {
static styles = [base, styles]

@property({type: String}) value = ''

render() {
return html`
<div class="editor" contenteditable="plaintext-only">${this.value}</div>
`
}
}
27 changes: 12 additions & 15 deletions static/2024-05-30-app-skeleton-lit/src/components/com-unibox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ const styles = css`

.unibox {
display: grid;
grid-template-columns: min-content 1fr min-content;
grid-template-areas: "start main end";
background-color: var(--color-white);
border-radius: var(--radius);
grid-template-columns: 1fr min-content;
grid-template-areas: "main end";
gap: var(--gap);
padding: calc(var(--unit) * 2);
}

.unibox-main {
grid-area: main;
}

.unibox-start {
grid-area: start;
align-self: center;
}

.unibox-end {
Expand All @@ -33,17 +33,14 @@ export class ComUnibox extends LitElement {

render() {
return html`
<menu class="unibox">
<li class="unibox-start">
<slot name="start"></slot>
</li>
<li class="unibox-main">
<div class="unibox">
<div class="unibox-main">
<slot name="main"></slot>
</li>
<li class="unibox-end">
</div>
<div class="unibox-end">
<slot name="end"></slot>
</li>
</menu>
</div>
</div>
`
}
}
Expand Down
3 changes: 2 additions & 1 deletion static/2024-05-30-app-skeleton-lit/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export * as ComPrompt from './components/com-prompt'
export * as ComResponse from './components/com-response'
export * as ComThreadGroup from './components/com-thread-group'
export * as ComButton from './components/com-button'
export * as ComUnibox from './components/com-unibox'
export * as ComUnibox from './components/com-unibox'
export * as ComEditor from './components/com-editor'