diff --git a/src/app/home/home.component.css b/src/app/home/home.component.css index 3669da6..5aa9ee1 100644 --- a/src/app/home/home.component.css +++ b/src/app/home/home.component.css @@ -67,14 +67,16 @@ margin-top: 10px; } - .made-div{ + .container { display: flex; justify-content: center; align-items: center; - height: 100%; - width: 100%; - } + + .made-div { + text-align: center; /* Optional: To center the text within the div */ + } + /* Add a media query if the width less 290 px */ @media screen and (max-width: 290px) { diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 04fdc6b..5dd0b71 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -18,9 +18,12 @@ spellcheck="false" > -
- Made with by Varshith +
+
+ Made with by Varshith +
+
Word Count: {{ words }} | Character Count: {{ characters }}
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 55455aa..859a29b 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -68,7 +68,6 @@ export class HomeComponent implements OnInit { // Update word and character counts this.updateWordAndCharacterCount(); } - }); } else { console.error('Route ID is null or undefined'); @@ -137,36 +136,35 @@ export class HomeComponent implements OnInit { } // Tab key functionality -onTextareaKeydown(event: KeyboardEvent) { - // Check if the pressed key is Tab - if (event.key === 'Tab') { - // Prevent the default Tab behavior (e.g., moving focus to the next element) - event.preventDefault(); + onTextareaKeydown(event: KeyboardEvent) { + // Check if the pressed key is Tab + if (event.key === 'Tab') { + // Prevent the default Tab behavior (e.g., moving focus to the next element) + event.preventDefault(); - // Insert a tab character at the current cursor position - const textarea = event.target as HTMLTextAreaElement; - const start = textarea.selectionStart; - const end = textarea.selectionEnd; + // Insert a tab character at the current cursor position + const textarea = event.target as HTMLTextAreaElement; + const start = textarea.selectionStart; + const end = textarea.selectionEnd; - // Get the text before and after the cursor position - const textBeforeCursor = textarea.value.substring(0, start); - const textAfterCursor = textarea.value.substring(end); + // Get the text before and after the cursor position + const textBeforeCursor = textarea.value.substring(0, start); + const textAfterCursor = textarea.value.substring(end); - // Combine the text with a tab character at the cursor position - const newText = textBeforeCursor + '\t' + textAfterCursor; + // Combine the text with a tab character at the cursor position + const newText = textBeforeCursor + '\t' + textAfterCursor; - // Update the textarea value - textarea.value = newText; + // Update the textarea value + textarea.value = newText; - // Update the cursor position - const newCursorPos = start + 1; - textarea.setSelectionRange(newCursorPos, newCursorPos); + // Update the cursor position + const newCursorPos = start + 1; + textarea.setSelectionRange(newCursorPos, newCursorPos); - // Update word and character counts - this.updateWordAndCharacterCount(); + // Update word and character counts + this.updateWordAndCharacterCount(); + } } -} - updateWordAndCharacterCount() { if (this.text) {