feat: Change file structure
- Move return object to named export for 11ty config - screens is now view - 11ty data files moved to view/_data - templates is now view/_includes - Both are the default directories - data is now used as intended, for user data - Update index to reflect filenames and structure
This commit is contained in:
parent
610e22b3c9
commit
b67a8a893a
78 changed files with 21 additions and 19 deletions
60
source/view/demo/examples/ui/cli.liquid
Normal file
60
source/view/demo/examples/ui/cli.liquid
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
title: CLI
|
||||
tags:
|
||||
- ui
|
||||
---
|
||||
{% assign bodyClass = 'body_cli' -%}
|
||||
{% layout 'hippie/app.liquid' %}
|
||||
|
||||
{% block body %}
|
||||
<div id="cli">
|
||||
<div id="history">
|
||||
<pre>Previous prompt</pre>
|
||||
</div>
|
||||
<div id="line">
|
||||
<textarea name="prefix" id="prefix" rows="1" cols="1" readonly>></textarea>
|
||||
<textarea name="prompt" id="prompt" rows="1" autofocus></textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{%- block script %}
|
||||
{{ block.super -}}
|
||||
<script>
|
||||
function resizeTextArea(textarea) {
|
||||
const {style, value} = textarea;
|
||||
|
||||
style.height = style.minHeight = 'auto';
|
||||
style.minHeight = `${Math.min(textarea.scrollHeight + 4, parseInt(textarea.style.maxHeight))}px`;
|
||||
style.height = `${textarea.scrollHeight}px`;
|
||||
}
|
||||
|
||||
const textarea = document.getElementById('prompt');
|
||||
|
||||
document
|
||||
.body
|
||||
.addEventListener('click', () => {
|
||||
textarea.focus();
|
||||
});
|
||||
|
||||
textarea.addEventListener('input', () => {
|
||||
resizeTextArea(textarea);
|
||||
});
|
||||
|
||||
window.addEventListener("keydown", (event) => {
|
||||
if (event.key === 'Enter' && !event.shiftKey) {
|
||||
event.preventDefault();
|
||||
|
||||
const p = document.createElement("pre");
|
||||
|
||||
p.textContent = event.target.value;
|
||||
document
|
||||
.getElementById("history")
|
||||
.appendChild(p);
|
||||
// window.scrollTo(0, document.body.scrollHeight);
|
||||
|
||||
event.target.value = '';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue