mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 04:33:42 +08:00
[resumes][feat] use primary buttons (#441)
This commit is contained in:
@ -48,13 +48,15 @@ export default function ResumeCommentsList({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (commentsQuery.isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="space-y-3">
|
|
||||||
{commentsQuery.isLoading ? (
|
|
||||||
<div className="col-span-10 pt-4">
|
<div className="col-span-10 pt-4">
|
||||||
<Spinner display="block" size="lg" />
|
<Spinner display="block" size="lg" />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="mb-8 flow-root h-[calc(100vh-13rem)] w-full flex-col space-y-10 overflow-y-auto overflow-x-hidden pb-16">
|
<div className="mb-8 flow-root h-[calc(100vh-13rem)] w-full flex-col space-y-10 overflow-y-auto overflow-x-hidden pb-16">
|
||||||
{RESUME_COMMENTS_SECTIONS.map(({ label, value }) => {
|
{RESUME_COMMENTS_SECTIONS.map(({ label, value }) => {
|
||||||
const comments = commentsQuery.data
|
const comments = commentsQuery.data
|
||||||
@ -105,7 +107,5 @@ export default function ResumeCommentsList({
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
|||||||
import Error from 'next/error';
|
import Error from 'next/error';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { signIn, useSession } from 'next-auth/react';
|
import { useSession } from 'next-auth/react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
AcademicCapIcon,
|
AcademicCapIcon,
|
||||||
@ -142,24 +142,21 @@ export default function ResumeReviewPage() {
|
|||||||
const renderReviewButton = () => {
|
const renderReviewButton = () => {
|
||||||
if (session === null) {
|
if (session === null) {
|
||||||
return (
|
return (
|
||||||
<div className=" flex h-10 justify-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-[400] hover:cursor-pointer hover:bg-slate-50">
|
<Button
|
||||||
<a
|
className="h-10 shadow-md"
|
||||||
|
display="block"
|
||||||
href="/api/auth/signin"
|
href="/api/auth/signin"
|
||||||
onClick={(event) => {
|
label="Sign in to join discussion"
|
||||||
event.preventDefault();
|
variant="primary"
|
||||||
signIn();
|
/>
|
||||||
}}>
|
|
||||||
Sign in to join discussion
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
className="h-10 py-2 shadow-md"
|
className="h-10 shadow-md"
|
||||||
display="block"
|
display="block"
|
||||||
label="Add your review"
|
label="Add your review"
|
||||||
variant="tertiary"
|
variant="primary"
|
||||||
onClick={() => setShowCommentsForm(true)}
|
onClick={() => setShowCommentsForm(true)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -209,14 +206,15 @@ export default function ResumeReviewPage() {
|
|||||||
</h1>
|
</h1>
|
||||||
<div className="flex gap-3 xl:pr-4">
|
<div className="flex gap-3 xl:pr-4">
|
||||||
{userIsOwner && (
|
{userIsOwner && (
|
||||||
<button
|
<Button
|
||||||
className="h-10 rounded-md border border-slate-300 bg-white py-1 px-2 text-center shadow-md hover:bg-slate-50"
|
addonPosition="start"
|
||||||
type="button"
|
className="h-10 shadow-md"
|
||||||
onClick={onEditButtonClick}>
|
icon={PencilSquareIcon}
|
||||||
<PencilSquareIcon className="text-primary-600 h-6 w-6" />
|
label="Edit"
|
||||||
</button>
|
variant="tertiary"
|
||||||
|
onClick={onEditButtonClick}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<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 shadow-md hover:bg-slate-50 disabled:hover:bg-white"
|
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 shadow-md hover:bg-slate-50 disabled:hover:bg-white"
|
||||||
disabled={starMutation.isLoading || unstarMutation.isLoading}
|
disabled={starMutation.isLoading || unstarMutation.isLoading}
|
||||||
@ -239,13 +237,12 @@ export default function ResumeReviewPage() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
Star
|
{detailsQuery.data?.stars.length ? 'Starred' : 'Star'}
|
||||||
</span>
|
</span>
|
||||||
<span className="relative -ml-px inline-flex">
|
<span className="relative -ml-px inline-flex">
|
||||||
{detailsQuery.data?._count.stars}
|
{detailsQuery.data?._count.stars}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div className="hidden xl:block">{renderReviewButton()}</div>
|
<div className="hidden xl:block">{renderReviewButton()}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -326,21 +323,17 @@ export default function ResumeReviewPage() {
|
|||||||
<ResumePdf url={detailsQuery.data.url} />
|
<ResumePdf url={detailsQuery.data.url} />
|
||||||
</div>
|
</div>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<div className="relative p-2 xl:hidden">
|
<div className="mb-6 space-y-4 xl:hidden">
|
||||||
<div
|
{renderReviewButton()}
|
||||||
aria-hidden="true"
|
<div className="flex items-center space-x-2">
|
||||||
className="absolute inset-0 flex items-center">
|
<hr className="flex-grow border-slate-300" />
|
||||||
<div className="w-full border-t border-slate-300" />
|
|
||||||
</div>
|
|
||||||
<div className="relative flex justify-center">
|
|
||||||
<span className="bg-slate-50 px-3 text-lg font-medium text-slate-900">
|
<span className="bg-slate-50 px-3 text-lg font-medium text-slate-900">
|
||||||
Reviews
|
Reviews
|
||||||
</span>
|
</span>
|
||||||
|
<hr className="flex-grow border-slate-300" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-4 xl:hidden">{renderReviewButton()}</div>
|
|
||||||
|
|
||||||
{showCommentsForm ? (
|
{showCommentsForm ? (
|
||||||
<ResumeCommentsForm
|
<ResumeCommentsForm
|
||||||
resumeId={resumeId as string}
|
resumeId={resumeId as string}
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
XMarkIcon,
|
XMarkIcon,
|
||||||
} from '@heroicons/react/24/outline';
|
} from '@heroicons/react/24/outline';
|
||||||
import {
|
import {
|
||||||
|
Button,
|
||||||
CheckboxInput,
|
CheckboxInput,
|
||||||
CheckboxList,
|
CheckboxList,
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@ -540,16 +541,14 @@ export default function ResumeHomePage() {
|
|||||||
onChange={onTabChange}
|
onChange={onTabChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<Button
|
||||||
<button
|
className="lg:hidden"
|
||||||
className="bg-primary-500 ml-4 rounded-md py-2 px-3 text-sm font-medium text-white lg:hidden"
|
label="Submit Resume"
|
||||||
type="button"
|
variant="primary"
|
||||||
onClick={onSubmitResume}>
|
onClick={onSubmitResume}
|
||||||
Submit Resume
|
/>
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="flex flex-wrap items-center justify-start gap-6">
|
||||||
<div className="flex flex-wrap items-center justify-start gap-8">
|
|
||||||
<div className="w-64">
|
<div className="w-64">
|
||||||
<TextInput
|
<TextInput
|
||||||
isLabelHidden={true}
|
isLabelHidden={true}
|
||||||
@ -562,12 +561,18 @@ export default function ResumeHomePage() {
|
|||||||
onChange={setSearchValue}
|
onChange={setSearchValue}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<Button
|
||||||
|
className="lg:hidden"
|
||||||
|
icon={FunnelIcon}
|
||||||
|
isLabelHidden={true}
|
||||||
|
label="Filters"
|
||||||
|
variant="tertiary"
|
||||||
|
onClick={() => setMobileFiltersOpen(true)}
|
||||||
|
/>
|
||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
align="end"
|
align="end"
|
||||||
label={
|
label={
|
||||||
SORT_OPTIONS.find(({ value }) => value === sortOrder)
|
SORT_OPTIONS.find(({ value }) => value === sortOrder)?.label
|
||||||
?.label
|
|
||||||
}>
|
}>
|
||||||
{SORT_OPTIONS.map(({ label, value }) => (
|
{SORT_OPTIONS.map(({ label, value }) => (
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
@ -577,22 +582,12 @@ export default function ResumeHomePage() {
|
|||||||
onClick={() => setSortOrder(value)}></DropdownMenu.Item>
|
onClick={() => setSortOrder(value)}></DropdownMenu.Item>
|
||||||
))}
|
))}
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</div>
|
<Button
|
||||||
<button
|
className="hidden lg:block"
|
||||||
className="-m-2 text-slate-400 hover:text-slate-500 lg:hidden"
|
label="Submit Resume"
|
||||||
type="button"
|
variant="primary"
|
||||||
onClick={() => setMobileFiltersOpen(true)}>
|
onClick={onSubmitResume}
|
||||||
<span className="sr-only">Filters</span>
|
/>
|
||||||
<FunnelIcon aria-hidden="true" className="h-6 w-6" />
|
|
||||||
</button>
|
|
||||||
<div>
|
|
||||||
<button
|
|
||||||
className="bg-primary-500 hidden w-36 rounded-md py-2 px-3 text-sm font-medium text-white lg:block"
|
|
||||||
type="button"
|
|
||||||
onClick={onSubmitResume}>
|
|
||||||
Submit Resume
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{isFetchingResumes ? (
|
{isFetchingResumes ? (
|
||||||
|
Reference in New Issue
Block a user