diff --git a/src/app/generator/components/anagrammator/anagrammator.component.html b/src/app/generator/components/anagrammator/anagrammator.component.html index fa1d518..84fb4f9 100644 --- a/src/app/generator/components/anagrammator/anagrammator.component.html +++ b/src/app/generator/components/anagrammator/anagrammator.component.html @@ -1,9 +1,15 @@

Анаграматор

- - Зробити анаграму з: - - +
+ + Зробити анаграму з: + + + + Розділовий знак: + + +
Фільтр результатів:
diff --git a/src/app/generator/components/anagrammator/anagrammator.component.scss b/src/app/generator/components/anagrammator/anagrammator.component.scss index e72f63c..20e5aca 100644 --- a/src/app/generator/components/anagrammator/anagrammator.component.scss +++ b/src/app/generator/components/anagrammator/anagrammator.component.scss @@ -1,6 +1,13 @@ :host { display: block; + pre#result-render { + margin-top: 0; + font-size: 50px; + line-height: 70px; + font-family: Arial, Helvetica, sans-serif; + } + .rootenia { font-family: var(--rutenia-akcidenta-font) !important; } @@ -8,6 +15,12 @@ .container { margin: 1em; + .inputs { + display: grid; + grid-template-columns: 30% 17%; + gap: 3%; + } + .filters { display: grid; grid-template-columns: 30% 30% 30%; @@ -36,12 +49,6 @@ margin-right: .2em; } } - - pre { - margin-top: 0; - font-size: 80px; - line-height: 90px; - } } .axes { diff --git a/src/app/generator/components/anagrammator/anagrammator.component.ts b/src/app/generator/components/anagrammator/anagrammator.component.ts index 8683f5e..dded60b 100644 --- a/src/app/generator/components/anagrammator/anagrammator.component.ts +++ b/src/app/generator/components/anagrammator/anagrammator.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { AfterViewInit, Component, OnInit } from '@angular/core'; import { copyToClipboardWithVisualResponse } from '../../generator-helpers'; @Component({ @@ -7,12 +7,13 @@ import { copyToClipboardWithVisualResponse } from '../../generator-helpers'; styleUrls: ["./anagrammator.component.scss"], }) export class AnagrammatorComponent implements OnInit { - - capitalizeOutput = false; - shuffle = false; + + sourceWord = "Символ"; + divider = ""; + capitalizeOutput = true; + shuffle = true; toUseRutenia = false; - sourceWord = ""; anagrams = [""]; filtered = [""]; formattedResult = ""; @@ -28,6 +29,11 @@ export class AnagrammatorComponent implements OnInit { this.anagrammate(); } + setDivider($event: KeyboardEvent) { + this.divider = ($event.currentTarget as HTMLInputElement).value; + this.anagrammate(); + } + setSourceString(event: any) { this.sourceWord = event?.target?.value; this.anagrammate(); @@ -82,11 +88,12 @@ export class AnagrammatorComponent implements OnInit { (remaining = "") => { const res = [item].concat(remaining); const id = item + remaining; - result[id] = res.join(divider); + let joined: string = res.join(""); if (this.capitalizeOutput) { - result[id] = result[id].toLowerCase(); - result[id] = result[id].substring(0, 1).toUpperCase() + result[id].substring(1); - } + joined = joined.toLowerCase(); + joined = joined.charAt(0).toUpperCase() + joined.substring(1); + } + result[id] = joined; } ); }); @@ -111,10 +118,10 @@ export class AnagrammatorComponent implements OnInit { this.iteration = 0; this.anagrams = this.combineItems( - this.sourceWord.split(""), + this.sourceWord.split(this.divider), this.maxIterations, 0, - "" + this.divider ); const filteredByStart = this.startWith ? this.anagrams.filter((str) => str.indexOf(this.startWith) === 0)