refactor: optimize profile tag display and truncate location text across professional components

This commit is contained in:
pradeepkumar
2026-04-10 16:39:58 +05:30
parent 772a0cde3d
commit e5dfac0470
2 changed files with 12 additions and 11 deletions

View File

@@ -265,7 +265,7 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
const truncatedDescription = description && description.length > maxDescLength
? description.slice(0, maxDescLength) + '...'
: description || '';
const INITIAL_TAG_COUNT = 6;
const INITIAL_TAG_COUNT = 3;
return (
<div className="bg-white rounded-[20px] p-4 sm:p-5 flex flex-col sm:flex-row gap-4 sm:gap-5 shadow-[0px_10px_20px_rgba(217,217,217,0.5)] min-h-[280px]">
@@ -334,7 +334,7 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
width={16}
height={15}
/>
<span className="font-serif font-bold text-[14px] text-[#00293d]">
<span className="font-serif font-bold text-[14px] text-[#00293d] truncate max-w-[200px]" title={location}>
{location}
</span>
</div>
@@ -376,11 +376,11 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
{expertiseTags.length > 0 && (
<div className="mt-3">
<p className="font-fractul font-bold text-[14px] text-[#00293d] mb-2">Expertise:</p>
<div className="flex flex-wrap gap-2 items-center">
<div className={`flex gap-2 items-center ${showAllTags ? 'flex-wrap' : 'flex-nowrap overflow-hidden'}`}>
{(showAllTags ? expertiseTags : expertiseTags.slice(0, INITIAL_TAG_COUNT)).map((tag, index) => (
<span
key={index}
className="border border-[#00293d] rounded-[15px] px-3 py-1 font-serif text-[14px] text-[#00293d]"
className="border border-[#00293d] rounded-[15px] px-3 py-1 font-serif text-[14px] text-[#00293d] whitespace-nowrap flex-shrink-0"
>
{tag}
</span>
@@ -388,7 +388,7 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
{expertiseTags.length > INITIAL_TAG_COUNT && (
<button
onClick={() => setShowAllTags(!showAllTags)}
className="border border-[#e58625] rounded-[15px] px-3 py-1 font-serif text-[14px] text-[#e58625] hover:bg-[#e58625]/10 transition-colors"
className="border border-[#e58625] rounded-[15px] px-3 py-1 font-serif text-[14px] text-[#e58625] hover:bg-[#e58625]/10 transition-colors whitespace-nowrap flex-shrink-0"
>
{showAllTags ? 'Show Less' : `+${expertiseTags.length - INITIAL_TAG_COUNT} more`}
</button>