Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Feedback component polish (#33840)

Francesco Sansalvadoref77f1697ad87
diff --git a/apps/docs/components/Feedback/Feedback.tsx b/apps/docs/components/Feedback/Feedback.tsx
index 693a25c7bc7..16771ca6e5b 100644
--- a/apps/docs/components/Feedback/Feedback.tsx
+++ b/apps/docs/components/Feedback/Feedback.tsx
@@ -33,9 +33,9 @@ const FeedbackButton = forwardRef<
ref={ref}
className={cn(
'mt-0',
- 'flex items-center gap-2',
+ 'flex items-center gap-1',
'text-xs text-foreground-lighter',
- 'hover:text-foreground',
+ 'hover:text-foreground text-left',
!visible && 'opacity-0 invisible',
'[transition-property:opacity,color]',
'[transition-delay:700ms,0ms]'
@@ -141,72 +141,83 @@ function Feedback({ className }: { className?: string }) {
}
return (
- <section className={cn('@container px-5 mb-6', className)} aria-labelledby="feedback-title">
- <h3 id="feedback-title" className="block font-mono text-xs uppercase text-foreground mb-4">
+ <section className={cn('@container', className)} aria-labelledby="feedback-title">
+ <h3 id="feedback-title" className="block font-mono text-xs text-foreground-light mb-3">
Is this helpful?
</h3>
- <div className="relative flex flex-col gap-y-4 mb-2 @[12rem]:flex-row @[12rem]:items-center">
+ <div className="relative flex flex-col gap-2 @[12rem]:gap-4 @[12rem]:flex-row @[12rem]:items-center">
<div
style={{ '--container-flex-gap': '0.5rem' } as CSSProperties}
- className={`relative flex gap-[var(--container-flex-gap)] items-center`}
+ className="relative flex gap-2 items-center"
>
<Button
type="outline"
rounded
className={cn(
- 'px-1',
- !isYes && 'hover:text-brand-600 hover:border-brand-500',
- isYes && 'bg-brand text-brand-200 !border-brand disabled:opacity-100',
- !showYes && 'opacity-0 invisible',
- '[transition-property:opacity,transform,color] [transition-duration:150ms,300ms,300ms]',
- 'motion-reduce:[transition-duration:150ms,1ms,300ms]'
+ 'px-1 w-7 h-7',
+ 'text-foreground-light',
+ '[transition-property:opacity,transform,color] [transition-duration:150ms,250ms,250ms]',
+ 'motion-reduce:[transition-duration:150ms,1ms,300ms]',
+ '[transition-timing-function:cubic-bezier(.76,0,.23,1)]',
+ !isNo && 'hover:text-warning-600 hover:border-warning-500',
+ isNo && `bg-warning text-warning-200 !border-warning disabled:opacity-100`,
+ !showNo && 'opacity-0 invisible'
)}
- onClick={() => handleVote('yes')}
+ onClick={() => handleVote('no')}
disabled={state.type === StateType.Followup}
>
- <Check size={14} strokeWidth={3} />
- <span className="sr-only">Yes</span>
+ <X size={14} strokeWidth={2} className="text-current" />
+ <span className="sr-only">No</span>
</Button>
<Button
type="outline"
rounded
className={cn(
- 'px-1',
- !isNo && 'hover:text-warning-600 hover:border-warning-500',
- isNo &&
- `bg-warning text-warning-200 !border-warning -translate-x-[calc(100%+var(--container-flex-gap,0.5rem))] disabled:opacity-100`,
- !showNo && 'opacity-0 invisible',
- '[transition-property:opacity,transform,color] [transition-duration:150ms,300ms,300ms]',
- 'motion-reduce:[transition-duration:150ms,1ms,300ms]'
+ 'px-1 w-7 h-7',
+ 'text-foreground-light',
+ '[transition-property:opacity,transform,color] [transition-duration:150ms,250ms,250ms]',
+ 'motion-reduce:[transition-duration:150ms,1ms,300ms]',
+ '[transition-timing-function:cubic-bezier(.76,0,.23,1)]',
+ !isYes && 'hover:text-brand-600 hover:border-brand-500',
+ isYes &&
+ 'bg-brand text-brand-200 !border-brand disabled:opacity-100 -translate-x-[calc(100%+var(--container-inline-flex-gap,0.5rem))]',
+ !showYes && 'opacity-0 invisible'
)}
- onClick={() => handleVote('no')}
+ onClick={() => handleVote('yes')}
disabled={state.type === StateType.Followup}
>
- <X size={14} strokeWidth={3} />
- <span className="sr-only">No</span>
+ <Check size={14} strokeWidth={2} />
+ <span className="sr-only">Yes</span>
</Button>
</div>
<div
className={cn(
- 'flex flex-col gap-1',
+ 'flex flex-col gap-0.5',
+ '@[12rem]:absolute @[12rem]:left-9',
'text-xs',
'opacity-0 invisible',
'text-left',
- '-translate-x-[0.25rem] @[12rem]:-translate-x-[1.25rem]',
- '[transition-property:opacity,transform] [transition-duration:150ms,300ms]',
+ '-translate-x-2',
+ '[transition-property:opacity,transform]',
+ '[transition-duration:450ms,300ms]',
+ '[transition-delay:200ms,0ms]',
+ '[transition-timing-function:cubic-bezier(.76,0,.23,1)]',
'motion-reduce:[transition-duration:150ms,1ms]',
- 'delay-300',
- state.type === StateType.Followup &&
- 'opacity-100 visible -translate-x-0 @[12rem]:-translate-x-[1rem]'
+ '!ease-out',
+ state.type === StateType.Followup && 'opacity-100 visible -translate-x-0'
)}
>
- <span className="text-foreground-light">Thanks for your feedback!</span>
- <FeedbackButton
- ref={feedbackButtonRef}
- onClick={() => setModalOpen(true)}
- isYes={isYes}
- visible={!unanswered}
- />
+ {state.type === StateType.Followup && (
+ <>
+ <span className="text-foreground-light">Thanks for your feedback!</span>
+ <FeedbackButton
+ ref={feedbackButtonRef}
+ onClick={() => setModalOpen(true)}
+ isYes={isYes}
+ visible={true}
+ />
+ </>
+ )}
</div>
</div>
<FeedbackModal
diff --git a/apps/docs/components/GuidesTableOfContents.tsx b/apps/docs/components/GuidesTableOfContents.tsx
index 32ad52df066..6895fee3ba5 100644
--- a/apps/docs/components/GuidesTableOfContents.tsx
+++ b/apps/docs/components/GuidesTableOfContents.tsx
@@ -131,16 +131,25 @@ const GuidesTableOfContents = ({
const tocVideoPreview = `https://img.youtube.com/vi/${video}/0.jpg`
return (
- <div className={cn('border-l', 'thin-scrollbar overflow-y-auto', 'px-2', className)}>
+ <div
+ className={cn(
+ 'border-l flex flex-col gap-6 lg:gap-8',
+ 'thin-scrollbar overflow-y-auto',
+ 'px-2',
+ className
+ )}
+ >
{video && (
- <div className="relative mb-6 pl-5">
+ <div className="relative pl-5">
<ExpandableVideo imgUrl={tocVideoPreview} videoId={video} />
</div>
)}
- <Feedback key={pathname} />
+ <div className="pl-5">
+ <Feedback key={pathname} />
+ </div>
{displayedList.length > 0 && (
- <>
- <span className="block font-mono text-xs uppercase text-foreground px-5 mb-6">
+ <div>
+ <span className="block font-mono text-xs uppercase text-foreground px-5 mb-3">
On this page
</span>
<ul className="toc-menu list-none pl-5 text-[0.8rem] grid gap-2">
@@ -163,7 +172,7 @@ const GuidesTableOfContents = ({
</li>
))}
</ul>
- </>
+ </div>
)}
</div>
)
diff --git a/apps/docs/features/docs/GuidesMdx.template.tsx b/apps/docs/features/docs/GuidesMdx.template.tsx
index 4a951dccfbc..471f94c358b 100644
--- a/apps/docs/features/docs/GuidesMdx.template.tsx
+++ b/apps/docs/features/docs/GuidesMdx.template.tsx
@@ -115,7 +115,7 @@ const GuideTemplate = ({ meta, content, children, editLink, mdxOptions }: GuideT
<GuidesTableOfContents
video={meta?.tocVideo}
className={cn(
- 'hidden md:block',
+ 'hidden md:flex',
'col-span-3 self-start',
'sticky',
/**
diff --git a/apps/docs/features/docs/Troubleshooting.page.tsx b/apps/docs/features/docs/Troubleshooting.page.tsx
index 59bfb3d4152..1748c592672 100644
--- a/apps/docs/features/docs/Troubleshooting.page.tsx
+++ b/apps/docs/features/docs/Troubleshooting.page.tsx
@@ -94,7 +94,7 @@ export default async function TroubleshootingPage({ entry }: { entry: ITroublesh
<hr className="my-6" aria-hidden />
</>
)}
- <Feedback className="px-0" />
+ <Feedback className="px-0 mb-6 lg:mb-8" />
</aside>
</div>
</article>