[questions][ui] Minor UI cleanup (#470)

* [questions][ui] fix no more questions overlap

* [questions][ui] remove redundent horizontal div

* [questions][ui] reduce gap
pull/473/head
Ren Weilin 2 years ago committed by GitHub
parent 85fd874769
commit 68f3c72945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,13 +35,7 @@ export default function ContributeQuestionDialog({
return ( return (
<div> <div>
<Transition.Root as={Fragment} show={show}> <Transition.Root as={Fragment} show={show}>
<Dialog <Dialog as="div" className="relative z-10" onClose={onCancel}>
as="div"
className="relative z-10"
onClose={() => {
// Todo: save state
onCancel();
}}>
<Transition.Child <Transition.Child
as={Fragment} as={Fragment}
enter="ease-out duration-300" enter="ease-out duration-300"

@ -115,7 +115,6 @@ export default function ContributeQuestionForm({
rows={5} rows={5}
{...register('questionContent')} {...register('questionContent')}
/> />
<HorizontalDivider />
<h2 className="text-md text-primary-800 font-semibold"> <h2 className="text-md text-primary-800 font-semibold">
Additional information Additional information
</h2> </h2>

@ -486,7 +486,7 @@ export default function QuestionsBrowsePage() {
<main className="flex flex-1 flex-col items-stretch"> <main className="flex flex-1 flex-col items-stretch">
<div className="flex h-full flex-1"> <div className="flex h-full flex-1">
<section className="flex min-h-0 flex-1 flex-col items-center overflow-auto"> <section className="flex min-h-0 flex-1 flex-col items-center overflow-auto">
<div className="m-4 flex max-w-3xl flex-1 flex-col items-stretch justify-start gap-8"> <div className="m-4 flex max-w-3xl flex-1 flex-col items-stretch justify-start gap-6">
<ContributeQuestionCard <ContributeQuestionCard
onSubmit={(data) => { onSubmit={(data) => {
const { cityId, countryId, stateId } = data.location; const { cityId, countryId, stateId } = data.location;
@ -502,60 +502,64 @@ export default function QuestionsBrowsePage() {
}); });
}} }}
/> />
<div className="sticky top-0 border-b border-slate-300 bg-slate-50 py-4"> <div className="flex flex-col items-stretch gap-4">
<QuestionSearchBar <div className="sticky top-0 border-b border-slate-300 bg-slate-50 py-4">
sortOrderValue={sortOrder} <QuestionSearchBar
sortTypeValue={sortType} sortOrderValue={sortOrder}
onFilterOptionsToggle={() => { sortTypeValue={sortType}
setFilterDrawerOpen(!filterDrawerOpen); onFilterOptionsToggle={() => {
}} setFilterDrawerOpen(!filterDrawerOpen);
onSortOrderChange={setSortOrder} }}
onSortTypeChange={setSortType} onSortOrderChange={setSortOrder}
/> onSortTypeChange={setSortType}
</div> />
<div className="flex flex-col gap-2 pb-4"> </div>
{(questionsQueryData?.pages ?? []).flatMap( <div className="flex flex-col gap-2 pb-4">
({ data: questions }) => {(questionsQueryData?.pages ?? []).flatMap(
questions.map((question) => { ({ data: questions }) =>
const { companyCounts, countryCounts, roleCounts } = questions.map((question) => {
relabelQuestionAggregates( const { companyCounts, countryCounts, roleCounts } =
question.aggregatedQuestionEncounters, relabelQuestionAggregates(
); question.aggregatedQuestionEncounters,
);
return ( return (
<QuestionOverviewCard <QuestionOverviewCard
key={question.id} key={question.id}
answerCount={question.numAnswers} answerCount={question.numAnswers}
companies={companyCounts} companies={companyCounts}
content={question.content} content={question.content}
countries={countryCounts} countries={countryCounts}
href={`/questions/${question.id}/${createSlug( href={`/questions/${question.id}/${createSlug(
question.content, question.content,
)}`} )}`}
questionId={question.id} questionId={question.id}
receivedCount={question.receivedCount} receivedCount={question.receivedCount}
roles={roleCounts} roles={roleCounts}
timestamp={question.seenAt.toLocaleDateString( timestamp={question.seenAt.toLocaleDateString(
undefined, undefined,
{ {
month: 'short', month: 'short',
year: 'numeric', year: 'numeric',
}, },
)} )}
type={question.type} type={question.type}
upvoteCount={question.numVotes} upvoteCount={question.numVotes}
/> />
); );
}), }),
)} )}
<PaginationLoadMoreButton query={questionsInfiniteQuery} /> {questionCount !== 0 && (
{questionCount === 0 && ( <PaginationLoadMoreButton query={questionsInfiniteQuery} />
<div className="flex w-full items-center justify-center gap-2 rounded-md border border-slate-300 bg-slate-200 p-4 text-slate-600"> )}
<NoSymbolIcon className="h-6 w-6" /> {questionCount === 0 && (
<p>Nothing found.</p> <div className="flex w-full items-center justify-center gap-2 rounded-md border border-slate-300 bg-slate-200 p-4 text-slate-600">
{hasFilters && <p>Try changing your search criteria.</p>} <NoSymbolIcon className="h-6 w-6" />
</div> <p>Nothing found.</p>
)} {hasFilters && <p>Try changing your search criteria.</p>}
</div>
)}
</div>
</div> </div>
</div> </div>
</section> </section>

Loading…
Cancel
Save