Skip to content

Commit

Permalink
overall better
Browse files Browse the repository at this point in the history
  • Loading branch information
mishankov committed Feb 22, 2024
1 parent 0d6a593 commit a6b1004
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 31 deletions.
30 changes: 14 additions & 16 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@
import ManipulationsPanel from "./ManipulationsPanel.svelte";
import TextArea from "./components/TextArea.svelte";
import Heading from "./components/Heading.svelte";
let source = "Try me!\nPress \"Apply\""
let source = "Try me!\nResult will update automatically"
let result = ""
let manipulations: TManipulation[] = [{
type: "replace",
from: "\\n", to: "--", id: "initial"
from: "\\n", to: " -- ", id: "initial"
}]
function onApply(event: MouseEvent) {
if (event.type == "click") {
result = applyManipulations(source, manipulations)
}
}
document.addEventListener("keydown", (event) => {
if (event.ctrlKey && event.key === "Enter") {
result = applyManipulations(source, manipulations)
Expand All @@ -28,26 +23,29 @@

<div class="panels">
<div class="panel">
<TextArea id="source" labelText="Source" bind:value={source} />
<Heading text="Source" />
<TextArea id="source" bind:value={source} />
</div>

<div class="panel">
<TextArea id="result" labelText="Result" bind:value={result} />
<Heading text="Manipulations" />
<ManipulationsPanel bind:manipulations />
</div>

<div class="panel">
<ManipulationsPanel bind:manipulations />
<!-- <button on:click={onApply}>Apply</button> -->
<Heading text="Result" />
<TextArea id="result" bind:value={result} />
</div>

</div>


<style>
.panels {
display: flex;
flex-direction: row;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 10px;
padding: 10px;
}
.panel {
Expand Down
2 changes: 0 additions & 2 deletions src/ManipulationsPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import { ManipulationsList } from "./manipulations";
export let manipulations: TManipulation[] = []
// $: console.log(manipulations)
</script>

<div class="panel">
<label for="manipulations">Manipulations</label>
<ManipulationsList bind:manipulations/>
</div>

Expand Down
3 changes: 2 additions & 1 deletion src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ html {
--bg-color-100: hsl(157, 100%, 90%);
--border-color-100: hsl(157, 100%, 10%);

--text-color: #000
--text-color: hsl(157, 100%, 10%);
}

body {
background-color: var(--bg-color-100);
font-family: monospace;
}
12 changes: 12 additions & 0 deletions src/components/Heading.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts">
export let text: string
</script>

<h1>{text}</h1>

<style>
h1 {
color: var(--text-color);
font-family: monospace;
}
</style>
8 changes: 4 additions & 4 deletions src/components/TextArea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

<style>
textarea {
height: 500px;
width: 300px;
/* background-color: #FFF; */
width: 100%;
color: var(--text-color);
border-radius: 10px;
border: 1px solid var(--border-color-100);
border: 2px solid var(--border-color-100);
padding: 10px;
font-family: monospace;
}
textarea:focus {
Expand Down
10 changes: 2 additions & 8 deletions src/manipulations/components/Manipulation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@
</div>

<style>
:global(.manipulation) {
/* default colors */
--manipulation-bg-color: grey;
--manipulation-border-color: white;
}
div {
display: flex;
flex-direction: row;
Expand All @@ -66,6 +58,8 @@
padding: 0px;
padding-left: 5px;
padding-right: 5px;
margin-left: auto;
}
.delete:hover {
Expand Down

0 comments on commit a6b1004

Please sign in to comment.