[questions][ui] improve browse mobile ui

pull/531/head
Jeff Sieu 2 years ago
parent 4a1e95a777
commit 7b044e11c3

@ -20,31 +20,43 @@ export default function QuestionSearchBar({
...sortOptionsSelectProps ...sortOptionsSelectProps
}: QuestionSearchBarProps) { }: QuestionSearchBarProps) {
return ( return (
<div className="flex flex-col items-stretch gap-x-4 gap-y-2 lg:flex-row lg:items-end"> <div className="flex flex-col items-stretch gap-x-4 gap-y-4 lg:flex-row lg:items-end">
<div className="flex-1 "> <div className="flex flex-1 gap-2">
<TextInput <div className="flex-1">
isLabelHidden={true} <TextInput
label="Search by content" isLabelHidden={true}
placeholder="Search by content" label="Search by content"
startAddOn={MagnifyingGlassIcon} placeholder="Search by content"
startAddOnType="icon" startAddOn={MagnifyingGlassIcon}
value={query} startAddOnType="icon"
onChange={(value) => { value={query}
onQueryChange(value); onChange={(value) => {
}} onQueryChange(value);
/> }}
</div> />
<div className="flex items-end justify-end gap-4"> </div>
<SortOptionsSelect {...sortOptionsSelectProps} /> <div className="sm:hidden">
<div className="lg:hidden">
<Button <Button
addonPosition="start" addonPosition="start"
icon={AdjustmentsHorizontalIcon} icon={AdjustmentsHorizontalIcon}
label="Filter options" isLabelHidden={true}
label="Filters"
variant="tertiary" variant="tertiary"
onClick={onFilterOptionsToggle} onClick={onFilterOptionsToggle}
/> />
</div> </div>
<div className="hidden sm:block lg:hidden">
<Button
addonPosition="start"
icon={AdjustmentsHorizontalIcon}
label="Filters"
variant="tertiary"
onClick={onFilterOptionsToggle}
/>
</div>
</div>
<div className="flex items-end justify-end gap-4">
<SortOptionsSelect {...sortOptionsSelectProps} />
</div> </div>
</div> </div>
); );

@ -177,12 +177,26 @@ export default function BaseQuestionCard({
const cardContent = ( const cardContent = (
<> <>
{showVoteButtons && ( {showVoteButtons && (
<VotingButtons <>
upvoteCount={upvoteCount} <div className="md:hidden">
vote={vote} <VotingButtons
onDownvote={handleDownvote} size="sm"
onUpvote={handleUpvote} upvoteCount={upvoteCount}
/> vote={vote}
onDownvote={handleDownvote}
onUpvote={handleUpvote}
/>
</div>
<div className="hidden md:block">
<VotingButtons
size="md"
upvoteCount={upvoteCount}
vote={vote}
onDownvote={handleDownvote}
onUpvote={handleUpvote}
/>
</div>
</>
)} )}
<div className="flex flex-1 flex-col items-start gap-2"> <div className="flex flex-1 flex-col items-start gap-2">
<div className="flex items-baseline justify-between self-stretch"> <div className="flex items-baseline justify-between self-stretch">
@ -230,22 +244,48 @@ export default function BaseQuestionCard({
showCreateEncounterButton) && ( showCreateEncounterButton) && (
<div className="flex gap-2"> <div className="flex gap-2">
{showAnswerStatistics && ( {showAnswerStatistics && (
<Button <>
addonPosition="start" <div className="sm:hidden">
icon={ChatBubbleBottomCenterTextIcon} <Button
label={`${answerCount} answers`} addonPosition="start"
size="sm" icon={ChatBubbleBottomCenterTextIcon}
variant="tertiary" label={`${answerCount}`}
/> size="sm"
variant="tertiary"
/>
</div>
<div className="hidden sm:block">
<Button
addonPosition="start"
icon={ChatBubbleBottomCenterTextIcon}
label={`${answerCount} answers`}
size="sm"
variant="tertiary"
/>
</div>
</>
)} )}
{showReceivedStatistics && ( {showReceivedStatistics && (
<Button <>
addonPosition="start" <div className="sm:hidden">
icon={EyeIcon} <Button
label={`${receivedCount} received this`} addonPosition="start"
size="sm" icon={EyeIcon}
variant="tertiary" label={`${receivedCount}`}
/> size="sm"
variant="tertiary"
/>
</div>
<div className="hidden sm:block">
<Button
addonPosition="start"
icon={EyeIcon}
label={`${receivedCount} received this`}
size="sm"
variant="tertiary"
/>
</div>
</>
)} )}
{showCreateEncounterButton && ( {showCreateEncounterButton && (
<Button <Button

@ -503,7 +503,7 @@ export default function QuestionsBrowsePage() {
<main className="flex h-[calc(100vh_-_64px)] flex-1 flex-col items-stretch"> <main className="flex h-[calc(100vh_-_64px)] flex-1 flex-col items-stretch">
<div className="flex h-full flex-1"> <div className="flex h-full flex-1">
<section className="min-h-0 flex-1 overflow-auto"> <section className="min-h-0 flex-1 overflow-auto">
<div className="my-4 mx-auto flex max-w-3xl flex-col items-stretch justify-start gap-6"> <div className="my-4 mx-auto flex max-w-3xl flex-col items-stretch justify-start gap-6 p-4">
<ContributeQuestionCard <ContributeQuestionCard
onSubmit={(data) => { onSubmit={(data) => {
const { cityId, countryId, stateId } = data.location; const { cityId, countryId, stateId } = data.location;

Loading…
Cancel
Save