💄 UI Changes (#1804)

This commit is contained in:
Luke Vella 2025-07-09 15:35:05 +03:00 committed by GitHub
parent 56189c7381
commit 5af79028e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 40 additions and 24 deletions

View file

@ -261,7 +261,7 @@ export const Footer: React.FunctionComponent = () => {
</div>
<a
href="https://support.rallly.co/contribute/translations"
className="inline-flex items-center rounded-md border px-3 py-2 text-gray-500 text-xs hover:border-primary-600 hover:text-primary-600"
className="inline-flex h-8 items-center rounded-md border px-3 text-gray-500 text-xs hover:border-primary-600 hover:text-primary-600"
>
<LanguagesIcon className="mr-2 size-5" />
<Trans ns="common" i18nKey="volunteerTranslator" /> &rarr;

View file

@ -93,7 +93,7 @@ export async function AppSidebar({
/>
</p>
<UpgradeButton>
<Button size="sm" variant="primary" className="w-full">
<Button variant="primary" className="w-full">
<Trans i18nKey="upgrade" defaults="Upgrade" />
</Button>
</UpgradeButton>

View file

@ -13,9 +13,10 @@ const badgeVariants = cva(
destructive: "bg-destructive text-destructive-foreground",
outline: "text-foreground",
green: "bg-green-600 text-white",
secondary: "bg-primary-50 text-primary",
secondary: "border border-primary-200 bg-primary-50 text-primary",
},
size: {
sm: "h-5 min-w-5 px-1.5 text-xs",
md: "h-6 min-w-5 px-2 text-xs",
lg: "h-7 min-w-7 px-2.5 text-sm",
},

View file

@ -29,10 +29,10 @@ const buttonVariants = cva(
link: "border-transparent text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 gap-x-2 rounded-md px-2.5 text-sm",
sm: "h-8 gap-x-1.5 rounded-md px-2 text-sm",
default: "h-8 gap-x-2 rounded-md px-2 text-sm",
sm: "h-7 gap-x-1.5 rounded-md px-1.5 text-sm",
lg: "h-12 gap-x-3 rounded-lg px-4 text-base",
icon: "size-7 gap-x-1.5 rounded-md text-sm",
icon: "size-7 gap-x-1.5 rounded-lg text-sm",
"icon-lg": "size-8 rounded-full",
},
},

View file

@ -34,7 +34,7 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
hideCloseButton={true}
size="xl"
position="top"
className="p-0 shadow-huge"
className="p-0"
>
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:size-4 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:p-2 [&_[cmdk-item]_svg]:size-4">
{children}
@ -145,7 +145,7 @@ const CommandItemShortcut = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
"relative flex h-12 cursor-pointer select-none items-center gap-3 rounded-md px-3 font-medium outline-none aria-selected:bg-gray-100 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
"relative flex h-12 cursor-pointer select-none items-center gap-3 rounded-xl px-3 font-medium outline-none aria-selected:bg-gray-100 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
className,
)}
{...props}

View file

@ -6,6 +6,7 @@ import { cva } from "class-variance-authority";
import { XIcon } from "lucide-react";
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { Button } from "./button";
import { Icon } from "./icon";
import { cn } from "./lib/utils";
@ -37,7 +38,7 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const dialogContentVariants = cva(
cn(
//style
"gap-4 bg-background p-4 shadow-lg sm:rounded-lg sm:border",
"gap-4 bg-background p-4 shadow-lg sm:rounded-xl",
// position
"-translate-x-1/2 fixed top-0 left-1/2 z-50 grid w-full",
// animation
@ -51,6 +52,7 @@ const dialogContentVariants = cva(
"data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] sm:top-[50%] sm:translate-y-[-50%]",
},
size: {
xs: "sm:max-w-[400px]",
sm: "sm:max-w-sm",
md: "sm:max-w-md",
lg: "sm:max-w-lg",
@ -87,7 +89,7 @@ const DialogContent = React.forwardRef<
>
{children}
{!hideCloseButton ? (
<DialogClose asChild className="absolute top-4 right-4">
<DialogClose asChild className="absolute top-2 right-2">
<Button size="icon" variant="ghost">
<Icon>
<XIcon />
@ -104,9 +106,20 @@ DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({
className,
icon,
children,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div className={cn("flex flex-col space-y-1.5", className)} {...props} />
}: React.HTMLAttributes<HTMLDivElement> & {
icon?: React.ReactNode;
}) => (
<div className={cn("flex flex-col gap-4", className)} {...props}>
{icon ? (
<span className="inline-flex size-8 items-center justify-center rounded-lg bg-primary-foreground text-primary">
<Slot className="size-4">{icon}</Slot>
</span>
) : null}
<div>{children}</div>
</div>
);
DialogHeader.displayName = "DialogHeader";
@ -116,7 +129,7 @@ const DialogFooter = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
"mt-2 flex flex-col-reverse sm:flex-row sm:space-x-2",
className,
)}
{...props}
@ -145,7 +158,7 @@ const DialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-muted-foreground text-sm", className)}
className={cn("mt-2 text-muted-foreground text-sm", className)}
{...props}
/>
));

View file

@ -77,7 +77,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[140px] animate-in overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[140px] animate-in overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md",
className,
)}
{...props}
@ -96,7 +96,7 @@ const DropdownMenuItem = React.forwardRef<
ref={ref}
className={cn(
"flex items-center gap-x-2.5",
"relative flex cursor-default select-none items-center rounded px-2 py-1.5 font-medium text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"relative flex cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8",
className,
)}
@ -138,12 +138,12 @@ const DropdownMenuRadioItem = React.forwardRef<
<DropdownMenuPrimitive.RadioItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 font-medium text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"relative flex cursor-default select-none items-center rounded-md py-1.5 pr-8 pl-2 font-medium text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className,
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<Icon>
<CheckIcon />
@ -164,7 +164,7 @@ const DropdownMenuLabel = React.forwardRef<
<DropdownMenuPrimitive.Label
ref={ref}
className={cn(
"px-2 py-1.5 font-semibold text-sm",
"px-2 py-1.5 text-muted-foreground text-sm",
inset && "pl-8",
className,
)}

View file

@ -20,7 +20,7 @@ const inputVariants = cva(
variants: {
size: {
sm: "h-7 px-1 text-xs",
md: "h-9 px-2 text-sm",
md: "h-8 px-2 text-sm",
lg: "h-12 px-3 text-base",
},
variant: {

View file

@ -336,7 +336,7 @@ const SidebarInset = React.forwardRef<
<main
ref={ref}
className={cn(
"relative flex w-full flex-1 flex-col bg-background",
"flex w-full flex-1 flex-col bg-background",
"md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-lg md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:shadow-sm",
className,
)}
@ -526,11 +526,13 @@ const SidebarMenuItem = React.forwardRef<
SidebarMenuItem.displayName = "SidebarMenuItem";
const sidebarMenuButtonVariants = cva(
"peer/menu-button group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 flex w-full items-center gap-2.5 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
"peer/menu-button group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 flex w-full items-center gap-2.5 overflow-hidden rounded-lg p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] focus-visible:ring-2 focus-visible:ring-gray-400 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
{
variants: {
variant: {
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
primary: "text-primary data-[active=false]:hover:bg-primary-100",
default:
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:text-sidebar-accent-foreground focus:bg-sidebar-accent focus:text-sidebar-accent-foreground focus-visible:text-sidebar-accent-foreground data-[active=false]:hover:bg-sidebar-accent/50",
outline:
"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
},

View file

@ -70,7 +70,7 @@ const TileGrid = React.forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("grid gap-4 sm:grid-cols-2 lg:grid-cols-3", className)}
className={cn("grid gap-4 md:grid-cols-3 2xl:grid-cols-4", className)}
{...props}
/>
));