-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from aureliodeboa/dev-projects
Dev projects
- Loading branch information
Showing
7 changed files
with
68 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,27 @@ | ||
import { useState } from 'react'; | ||
|
||
interface ExpandableTextProps { | ||
text: string; | ||
maxLength: number; | ||
} | ||
|
||
const ExpandableText: React.FC<ExpandableTextProps> = ({ text, maxLength }) => { | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
|
||
const toggleExpand = () => { | ||
setIsExpanded(!isExpanded); | ||
}; | ||
|
||
return ( | ||
<div className="text-container"> | ||
<p className="text-justify text-sm sm:text-base md:text-lg"> | ||
{isExpanded ? text : `${text.substring(0, maxLength)}...`} | ||
</p> | ||
<button onClick={toggleExpand} className="text-yellow-500 hover:animate-pulse"> | ||
{isExpanded ? 'Ver menos' : 'Ver mais'} | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ExpandableText; |
This file contains 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 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 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