refactor: optimize profile tag display and truncate location text across professional components
This commit is contained in:
@@ -265,7 +265,7 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
|
|||||||
const truncatedDescription = description && description.length > maxDescLength
|
const truncatedDescription = description && description.length > maxDescLength
|
||||||
? description.slice(0, maxDescLength) + '...'
|
? description.slice(0, maxDescLength) + '...'
|
||||||
: description || '';
|
: description || '';
|
||||||
const INITIAL_TAG_COUNT = 6;
|
const INITIAL_TAG_COUNT = 3;
|
||||||
|
|
||||||
return (
|
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]">
|
<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}
|
width={16}
|
||||||
height={15}
|
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}
|
{location}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -376,11 +376,11 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
|
|||||||
{expertiseTags.length > 0 && (
|
{expertiseTags.length > 0 && (
|
||||||
<div className="mt-3">
|
<div className="mt-3">
|
||||||
<p className="font-fractul font-bold text-[14px] text-[#00293d] mb-2">Expertise:</p>
|
<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) => (
|
{(showAllTags ? expertiseTags : expertiseTags.slice(0, INITIAL_TAG_COUNT)).map((tag, index) => (
|
||||||
<span
|
<span
|
||||||
key={index}
|
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}
|
{tag}
|
||||||
</span>
|
</span>
|
||||||
@@ -388,7 +388,7 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
|
|||||||
{expertiseTags.length > INITIAL_TAG_COUNT && (
|
{expertiseTags.length > INITIAL_TAG_COUNT && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowAllTags(!showAllTags)}
|
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`}
|
{showAllTags ? 'Show Less' : `+${expertiseTags.length - INITIAL_TAG_COUNT} more`}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function ProfessionalCard({
|
|||||||
const [imgError, setImgError] = useState(false);
|
const [imgError, setImgError] = useState(false);
|
||||||
const placeholder = '/assets/icons/user-placeholder-icon.svg';
|
const placeholder = '/assets/icons/user-placeholder-icon.svg';
|
||||||
const isPlaceholder = imageUrl === placeholder;
|
const isPlaceholder = imageUrl === placeholder;
|
||||||
const INITIAL_TAG_COUNT = 4;
|
const INITIAL_TAG_COUNT = 3;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-white rounded-[15px] overflow-hidden shadow-[0px_4px_20px_rgba(0,0,0,0.08)] h-full flex flex-col">
|
<div className="bg-white rounded-[15px] overflow-hidden shadow-[0px_4px_20px_rgba(0,0,0,0.08)] h-full flex flex-col">
|
||||||
@@ -91,14 +91,15 @@ function ProfessionalCard({
|
|||||||
<p className="font-fractul font-bold text-[14px] leading-normal text-[#00293d]">
|
<p className="font-fractul font-bold text-[14px] leading-normal text-[#00293d]">
|
||||||
Location:
|
Location:
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center gap-1.5 mt-1">
|
<div className="flex items-center gap-1.5 mt-1 min-w-0">
|
||||||
<Image
|
<Image
|
||||||
src="/assets/icons/location-pin-orange.svg"
|
src="/assets/icons/location-pin-orange.svg"
|
||||||
alt="Location"
|
alt="Location"
|
||||||
width={12}
|
width={12}
|
||||||
height={15}
|
height={15}
|
||||||
|
className="flex-shrink-0"
|
||||||
/>
|
/>
|
||||||
<span className="font-serif font-normal text-[10px] leading-normal text-[#00293d]">
|
<span className="font-serif font-normal text-[10px] leading-normal text-[#00293d] truncate" title={location}>
|
||||||
{location}
|
{location}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -111,17 +112,17 @@ function ProfessionalCard({
|
|||||||
<p className="font-fractul font-bold text-[14px] leading-normal text-[#00293d]">
|
<p className="font-fractul font-bold text-[14px] leading-normal text-[#00293d]">
|
||||||
Expertise:
|
Expertise:
|
||||||
</p>
|
</p>
|
||||||
<div className="flex flex-wrap gap-1.5 mt-2 items-center">
|
<div className="flex flex-nowrap overflow-hidden gap-1.5 mt-2 items-center">
|
||||||
{expertise.slice(0, INITIAL_TAG_COUNT).map((tag, index) => (
|
{expertise.slice(0, INITIAL_TAG_COUNT).map((tag, index) => (
|
||||||
<span
|
<span
|
||||||
key={index}
|
key={index}
|
||||||
className="border-[0.7px] border-[#00293d] rounded-[15px] px-[5px] h-[24px] flex items-center justify-center font-serif font-normal text-[13px] leading-[100%] text-[#00293d]"
|
className="border-[0.7px] border-[#00293d] rounded-[15px] px-[5px] h-[24px] flex items-center justify-center font-serif font-normal text-[13px] leading-[100%] text-[#00293d] whitespace-nowrap flex-shrink-0"
|
||||||
>
|
>
|
||||||
{tag}
|
{tag}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
{expertise.length > INITIAL_TAG_COUNT && (
|
{expertise.length > INITIAL_TAG_COUNT && (
|
||||||
<span className="bg-[#e58625]/15 text-[#e58625] rounded-[15px] px-2 h-[24px] flex items-center justify-center font-serif font-semibold text-[12px] leading-[100%]">
|
<span className="bg-[#e58625]/15 text-[#e58625] rounded-[15px] px-2 h-[24px] flex items-center justify-center font-serif font-semibold text-[12px] leading-[100%] whitespace-nowrap flex-shrink-0">
|
||||||
+{expertise.length - INITIAL_TAG_COUNT} more
|
+{expertise.length - INITIAL_TAG_COUNT} more
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user