[resumes][refactor] make height calculation more robust

pull/509/head
Yangshun Tay 2 years ago
parent 762b55db4f
commit ec1487b33b

@ -35,10 +35,12 @@ export default function ResumePdf({ url }: Props) {
}, [pageWidth]); }, [pageWidth]);
return ( return (
<div className="w-full" id="pdfView"> <div
<div className="group relative bg-slate-100"> className="w-full flex-col overflow-y-auto lg:flex lg:h-full"
id="pdfView">
<div className="group relative grow bg-slate-100 lg:h-0">
<Document <Document
className="flex h-[calc(100vh-16rem)] flex-row justify-center overflow-auto py-8" className="flex flex-row justify-center overflow-auto py-8 lg:h-full"
file={url} file={url}
loading={<Spinner display="block" size="lg" />} loading={<Spinner display="block" size="lg" />}
noData="" noData=""

@ -92,7 +92,7 @@ export default function ResumeCommentListItem({
<> <>
<span className="font-medium text-slate-500">&middot;</span>{' '} <span className="font-medium text-slate-500">&middot;</span>{' '}
<button <button
className="px-1 text-xs font-medium text-slate-500 hover:text-slate-600" className="text-xs font-medium text-slate-500 hover:text-slate-600"
type="button" type="button"
onClick={() => setIsEditingComment(true)}> onClick={() => setIsEditingComment(true)}>
Edit Edit
@ -103,7 +103,7 @@ export default function ResumeCommentListItem({
<> <>
<span className="font-medium text-slate-500">&middot;</span>{' '} <span className="font-medium text-slate-500">&middot;</span>{' '}
<button <button
className="px-1 text-xs font-medium text-slate-500 hover:text-slate-600" className="text-xs font-medium text-slate-500 hover:text-slate-600"
type="button" type="button"
onClick={() => setIsReplyingComment(true)}> onClick={() => setIsReplyingComment(true)}>
Reply Reply

@ -115,7 +115,7 @@ export default function ResumeCommentsForm({
}; };
return ( return (
<div className="overflow-y-auto py-8 px-4 lg:h-[calc(100vh-13rem)]"> <div className="overflow-y-auto py-8 px-4">
<h2 className="text-xl font-medium text-slate-800"> <h2 className="text-xl font-medium text-slate-800">
Contribute a review Contribute a review
</h2> </h2>

@ -55,7 +55,7 @@ export default function ResumeCommentsList({
} }
return ( return (
<div className="flow-root w-full space-y-4 overflow-y-auto overflow-x-hidden px-4 lg:h-[calc(100vh-12rem)] lg:py-8"> <div className="flow-root w-full space-y-4 overflow-y-auto overflow-x-hidden px-4 lg:py-8">
{RESUME_COMMENTS_SECTIONS.map(({ label, value }) => { {RESUME_COMMENTS_SECTIONS.map(({ label, value }) => {
const comments = commentsQuery.data const comments = commentsQuery.data
? commentsQuery.data.filter((comment: ResumeComment) => { ? commentsQuery.data.filter((comment: ResumeComment) => {

@ -25,7 +25,7 @@ export default function ResumeExpandableText({
}; };
return ( return (
<div> <div className="space-y-1">
<span <span
ref={ref} ref={ref}
className={clsx( className={clsx(
@ -35,11 +35,12 @@ export default function ResumeExpandableText({
{text} {text}
</span> </span>
{descriptionOverflow && ( {descriptionOverflow && (
<p <button
className="text-primary-500 hover:text-primary-300 mt-1 cursor-pointer text-xs sm:text-sm" className="text-primary-500 hover:text-primary-600 text-xs font-medium"
type="button"
onClick={onSeeActionClicked}> onClick={onSeeActionClicked}>
{isExpanded ? 'See Less' : 'See More'} {isExpanded ? 'See Less' : 'See More'}
</p> </button>
)} )}
</div> </div>
); );

@ -235,15 +235,16 @@ export default function ResumeReviewPage() {
<Head> <Head>
<title>{`${detailsQuery.data.title} | Resume Review`}</title> <title>{`${detailsQuery.data.title} | Resume Review`}</title>
</Head> </Head>
<main className="h-full w-full bg-white"> <main className="flex h-[calc(100vh-4rem)] w-full flex-col bg-white">
<div className="mx-auto space-y-4 border-b border-slate-200 px-4 py-6 sm:px-6 lg:space-y-2 lg:px-8"> <div className="mx-auto w-full space-y-4 border-b border-slate-200 px-4 py-6 sm:px-6 lg:px-8">
<div className="flex flex-wrap justify-between space-y-4 lg:space-y-0"> <div className="justify-between gap-4 space-y-4 lg:flex lg:space-y-0">
<h1 className="pr-2 text-xl font-medium leading-7 text-slate-900 sm:text-2xl lg:w-[60%]"> <h1 className="pr-2 text-xl font-medium leading-7 text-slate-900">
{detailsQuery.data.title} {detailsQuery.data.title}
</h1> </h1>
<div className="flex gap-3"> <div className="flex gap-3">
{userIsOwner && ( {userIsOwner && (
<> <>
<div>
<Button <Button
addonPosition="start" addonPosition="start"
icon={PencilSquareIcon} icon={PencilSquareIcon}
@ -251,8 +252,10 @@ export default function ResumeReviewPage() {
variant="tertiary" variant="tertiary"
onClick={onEditButtonClick} onClick={onEditButtonClick}
/> />
</div>
<div>
<button <button
className="isolate inline-flex items-center space-x-4 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50 focus:ring-slate-600 disabled:hover:bg-white" className="isolate inline-flex items-center space-x-4 whitespace-nowrap rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50 focus:ring-slate-600 disabled:hover:bg-white"
disabled={resolveMutation.isLoading} disabled={resolveMutation.isLoading}
type="button" type="button"
onClick={onResolveButtonClick}> onClick={onResolveButtonClick}>
@ -274,10 +277,12 @@ export default function ResumeReviewPage() {
? 'Reopen for review' ? 'Reopen for review'
: 'Mark as reviewed'} : 'Mark as reviewed'}
</button> </button>
</div>
</> </>
)} )}
<div>
<button <button
className="isolate inline-flex h-10 items-center space-x-4 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50 focus:ring-slate-600 disabled:hover:bg-white" className="isolate inline-flex items-center space-x-4 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50 focus:ring-slate-600 disabled:hover:bg-white"
disabled={ disabled={
starMutation.isLoading || unstarMutation.isLoading starMutation.isLoading || unstarMutation.isLoading
} }
@ -304,11 +309,12 @@ export default function ResumeReviewPage() {
{detailsQuery.data?._count.stars} {detailsQuery.data?._count.stars}
</span> </span>
</button> </button>
</div>
<div className="hidden xl:block">{renderReviewButton()}</div> <div className="hidden xl:block">{renderReviewButton()}</div>
</div> </div>
</div> </div>
<div className="space-y-2"> <div className="space-y-2">
<div className="grid grid-cols-2 gap-2 md:flex md:flex-wrap md:space-x-8"> <div className="grid grid-cols-2 gap-2 lg:flex lg:flex-wrap lg:space-x-8">
<div className="col-span-1 flex items-center text-xs text-slate-600 sm:text-sm"> <div className="col-span-1 flex items-center text-xs text-slate-600 sm:text-sm">
<BriefcaseIcon <BriefcaseIcon
aria-hidden="true" aria-hidden="true"
@ -380,7 +386,7 @@ export default function ResumeReviewPage() {
</div> </div>
</div> </div>
{detailsQuery.data.additionalInfo && ( {detailsQuery.data.additionalInfo && (
<div className="col-span-2 flex items-start whitespace-pre-wrap pt-2 text-slate-600 xl:pt-1"> <div className="col-span-2 flex items-start whitespace-pre-wrap text-slate-600 xl:pt-1">
<InformationCircleIcon <InformationCircleIcon
aria-hidden="true" aria-hidden="true"
className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400" className="mr-1.5 h-5 w-5 flex-shrink-0 text-indigo-400"
@ -393,11 +399,11 @@ export default function ResumeReviewPage() {
)} )}
</div> </div>
</div> </div>
<div className="flex w-full flex-col divide-x divide-slate-200 lg:flex-row xl:py-0"> <div className="flex w-full shrink-0 grow flex-col divide-x divide-slate-200 overflow-hidden lg:h-0 lg:flex-row xl:py-0">
<div className="w-full bg-slate-100 lg:w-1/2"> <div className="w-full bg-slate-100 lg:h-full lg:w-1/2">
<ResumePdf url={detailsQuery.data.url} /> <ResumePdf url={detailsQuery.data.url} />
</div> </div>
<div className="grow border-t border-slate-200 bg-slate-50 pb-4 lg:border-none lg:pb-0"> <div className="grow overflow-y-auto border-t border-slate-200 bg-slate-50 pb-4 lg:h-full lg:border-t-0 lg:pb-0">
<div className="divide-y divide-slate-200 lg:hidden"> <div className="divide-y divide-slate-200 lg:hidden">
<div className="bg-white p-4 lg:p-0"> <div className="bg-white p-4 lg:p-0">
{renderReviewButton()} {renderReviewButton()}

Loading…
Cancel
Save