|
|
@ -10,7 +10,7 @@ export default function ResumeExpandableText({
|
|
|
|
children,
|
|
|
|
children,
|
|
|
|
}: ResumeExpandableTextProps) {
|
|
|
|
}: ResumeExpandableTextProps) {
|
|
|
|
const ref = useRef<HTMLSpanElement>(null);
|
|
|
|
const ref = useRef<HTMLSpanElement>(null);
|
|
|
|
const [descriptionExpanded, setDescriptionExpanded] = useState(false);
|
|
|
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
|
|
const [descriptionOverflow, setDescriptionOverflow] = useState(false);
|
|
|
|
const [descriptionOverflow, setDescriptionOverflow] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
useLayoutEffect(() => {
|
|
|
|
useLayoutEffect(() => {
|
|
|
@ -20,29 +20,27 @@ export default function ResumeExpandableText({
|
|
|
|
}, [ref]);
|
|
|
|
}, [ref]);
|
|
|
|
|
|
|
|
|
|
|
|
const onSeeActionClicked = () => {
|
|
|
|
const onSeeActionClicked = () => {
|
|
|
|
setDescriptionExpanded(!descriptionExpanded);
|
|
|
|
setIsExpanded((prevExpanded) => !prevExpanded);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div>
|
|
|
|
<span
|
|
|
|
<span
|
|
|
|
ref={ref}
|
|
|
|
ref={ref}
|
|
|
|
className={clsx(
|
|
|
|
className={clsx(
|
|
|
|
'whitespace-pre-wrap text-sm',
|
|
|
|
'whitespace-pre-wrap text-sm',
|
|
|
|
'line-clamp-3',
|
|
|
|
'line-clamp-3',
|
|
|
|
descriptionExpanded ? 'line-clamp-none' : '',
|
|
|
|
isExpanded ? 'line-clamp-none' : '',
|
|
|
|
)}>
|
|
|
|
)}>
|
|
|
|
{children}
|
|
|
|
{children}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
{descriptionOverflow && (
|
|
|
|
{descriptionOverflow && (
|
|
|
|
<div className="flex flex-row">
|
|
|
|
<p
|
|
|
|
<div
|
|
|
|
className="mt-1 cursor-pointer text-xs text-indigo-500 hover:text-indigo-300"
|
|
|
|
className="text-xs text-indigo-500 hover:text-indigo-300"
|
|
|
|
onClick={onSeeActionClicked}>
|
|
|
|
onClick={onSeeActionClicked}>
|
|
|
|
{isExpanded ? 'See Less' : 'See More'}
|
|
|
|
{descriptionExpanded ? 'See Less' : 'See More'}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|