-
Notifications
You must be signed in to change notification settings - Fork 366
added the feature of word count and fixed the misalignment #377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RashiS26
wants to merge
1
commit into
AOSSIE-Org:main
Choose a base branch
from
RashiS26:fix/Word-Count-and-Misalignment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import React, { useState } from 'react'; | ||
| // These icons come from the lucide-react library shown in your photo | ||
| import { AlignLeft, Hash, Type } from 'lucide-react'; | ||
|
|
||
| export default function App() { | ||
| // 1. Logic to track the text | ||
| const [text, setText] = useState(""); | ||
|
|
||
| // 2. Calculation logic | ||
| const wordCount = text.trim() ? text.trim().split(/\s+/).length : 0; | ||
| const charCount = text.length; | ||
|
|
||
| return ( | ||
| <div className="min-h-screen bg-gray-50 flex flex-col items-center justify-center p-6"> | ||
| <div className="w-full max-w-2xl bg-white p-8 rounded-3xl shadow-xl border border-gray-100"> | ||
|
|
||
| <div className="mb-6 flex items-center gap-3"> | ||
| <div className="p-2 bg-blue-600 rounded-lg"> | ||
| <Type className="text-white" size={24} /> | ||
| </div> | ||
| <h1 className="text-2xl font-bold text-gray-800">Live Word Counter</h1> | ||
| </div> | ||
|
|
||
| {/* 3. The Text Box Area */} | ||
| <div className="relative w-full"> | ||
| <textarea | ||
| value={text} | ||
| onChange={(e) => setText(e.target.value)} | ||
| placeholder="Start typing your content here..." | ||
| className="w-full h-80 p-6 border-2 border-gray-200 rounded-2xl focus:border-blue-500 focus:ring-4 focus:ring-blue-50 outline-none resize-none text-lg transition-all" | ||
| /> | ||
|
|
||
| {/* 4. The Counter Overlay inside the box */} | ||
| <div className="absolute bottom-6 right-6 flex items-center gap-4 bg-white/90 backdrop-blur-md px-4 py-2 rounded-full border border-gray-200 shadow-sm pointer-events-none select-none"> | ||
| <div className="flex items-center gap-2 text-sm font-bold text-blue-600"> | ||
| <AlignLeft size={16} /> | ||
| <span>{wordCount} words</span> | ||
| </div> | ||
| <div className="w-px h-4 bg-gray-300"></div> | ||
| <div className="flex items-center gap-2 text-sm font-bold text-gray-600"> | ||
| <Hash size={16} /> | ||
| <span>{charCount} characters</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <p className="mt-4 text-center text-gray-400 text-sm"> | ||
| Your text is automatically saved as you type. | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: AOSSIE-Org/EduAid
Length of output: 43
🏁 Script executed:
Repository: AOSSIE-Org/EduAid
Length of output: 3618
Add
lucide-reactto dependencies ineduaid_web/package.json.The import statement uses icons from
lucide-react, but this dependency is not declared in the package.json. The build will fail with a module not found error.🤖 Prompt for AI Agents