Show participated polls on polls page + UI refresh (#1089)

This commit is contained in:
Luke Vella 2024-05-12 13:20:00 +08:00 committed by GitHub
parent bd9e9fe95b
commit f8a217ae75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
125 changed files with 3007 additions and 2363 deletions

View file

@ -1,34 +1,35 @@
"use client";
import { Slot } from "@radix-ui/react-slot";
import { Loader2Icon } from "lucide-react";
import { cva, VariantProps } from "class-variance-authority";
import * as React from "react";
import { Loader2Icon } from "lucide-react";
import { cn } from "./lib/utils";
const buttonVariants = cva(
cn(
"inline-flex border font-medium disabled:pointer-events-none select-none disabled:opacity-50 items-center justify-center whitespace-nowrap rounded-md border",
"focus:ring-offset-input-background focus:border-primary-400 focus:ring-2 focus:ring-indigo-100",
"focus-visible:ring-offset-input-background focus-visible:ring-offset-1 focus-visible:ring-2 focus-visible:ring-gray-200",
"active:shadow-none",
),
{
variants: {
variant: {
primary:
"border-primary-700 bg-primary disabled:bg-gray-400 disabled:border-transparent text-primary-foreground shadow-sm hover:bg-primary-500 active:bg-primary-700",
"border-primary-700 shadow-sm bg-primary disabled:bg-gray-400 disabled:border-transparent text-primary-foreground shadow-sm hover:bg-primary-500 active:bg-primary-700",
destructive:
"bg-destructive text-destructive-foreground focus:ring-offset-1 active:bg-destructive border-destructive hover:bg-destructive/90",
"bg-destructive shadow-sm text-destructive-foreground focus-visible:ring-offset-1 active:bg-destructive border-destructive hover:bg-destructive/90",
default:
"rounded-md px-3.5 py-2.5 data-[state=open]:shadow-none data-[state=open]:bg-gray-100 active:bg-gray-200 hover:bg-gray-100 bg-gray-50",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "border-transparent hover:bg-gray-200 active:bg-gray-300",
link: "underline-offset-4 hover:underline text-primary",
ghost:
"border-transparent bg-transparent hover:bg-gray-200 active:bg-gray-300",
link: "underline-offset-4 border-transparent hover:text-primary-700 text-primary",
},
size: {
default: "h-9 px-2.5 gap-x-2.5 text-sm",
sm: "h-7 text-xs px-1.5 gap-x-1.5 rounded-md",
lg: "h-11 text-base gap-x-3 px-4 rounded-md",
sm: "h-7 text-sm px-1.5 gap-x-1.5 rounded-md",
lg: "h-11 text-sm gap-x-3 px-4 rounded-md",
},
},
defaultVariants: {
@ -42,7 +43,6 @@ export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
icon?: React.ComponentType<{ className?: string }>;
loading?: boolean;
}
@ -50,7 +50,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
(
{
className,
icon: Icon,
loading,
children,
variant,
@ -76,17 +75,10 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
type={type}
{...props}
>
{asChild ? (
children
{loading ? (
<Loader2Icon className="size-4 animate-spin opacity-75" />
) : (
<>
{loading ? (
<Loader2Icon className="size-4 animate-spin" />
) : Icon ? (
<Icon className={cn("-ml-0.5 size-4")} />
) : null}
{children}
</>
children
)}
</Comp>
);