Skip to content

Commit

Permalink
[TOOL-3075] Dashboard: Adjust theming, Improved light mode (thirdweb-…
Browse files Browse the repository at this point in the history
…dev#5956)

Fix "inverted look" of light mode - light mode now correctly has a slightly dark background and lighter cards on top

* Instead of `bg-muted/50`, use `bg-card` instead. `--card` color is updated
* For cards that are links, don't change the background color on hover - apply a subtle border change instead - added a `--active-border` for this - this looks great in both light and dark mode
* Prefer using `bg-accent` for hover effects instead of `bg-muted` (even though they are currently both same color) for adding hover accent. Use `bg-accent/50` for applying a very subtle accent - use cases: clickable table row

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the styles of various components in the application to replace the `bg-muted` class with `bg-card`, enhancing the visual consistency across the UI.

### Detailed summary
- Changed `className` from `bg-muted/50` to `bg-card` in multiple components.
- Updated hover effects from `hover:bg-muted` to `hover:bg-card`.
- Modified background colors in various layouts to use `bg-card` instead of `bg-muted`.
- Adjusted button and input styles for consistent theming.

> The following files were skipped due to too many changes: `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/table.tsx`, `apps/dashboard/src/components/configure-networks/ConfigureNetworkForm.tsx`, `apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/[blueprint_slug]/blueprint-playground.client.tsx`, `apps/dashboard/src/@/styles/globals.css`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/PayAnalytics.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/client/filters.tsx`, `apps/dashboard/src/app/components/sdk-component-theme.ts`, `apps/dashboard/src/components/settings/ApiKeys/Create/index.tsx`, `apps/dashboard/src/app/team/components/Analytics/EmptyState.tsx`, `apps/dashboard/src/components/settings/Account/Billing/CreditsItem.tsx`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
MananTank committed Jan 16, 2025
1 parent 15178b2 commit be7759d
Show file tree
Hide file tree
Showing 147 changed files with 403 additions and 375 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function ProjectAvatar(props: {
className={cn("rounded-lg border border-border", props.className)}
alt={""}
fallback={
<div className="flex items-center justify-center bg-muted/50">
<div className="flex items-center justify-center bg-card">
<BoxIcon className="size-[50%] text-muted-foreground" />
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function DangerSettingCard(props: {
return (
<div
className={cn(
"overflow-hidden rounded-lg border border-red-500/70",
"overflow-hidden rounded-lg border border-red-500/70 bg-card",
props.className,
)}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/blocks/Img.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function Img(props: imgElementProps) {
: _status;
const { className, fallback, skeleton, ...restProps } = props;
const defaultSkeleton = <div className="animate-pulse bg-accent" />;
const defaultFallback = <div className="bg-muted" />;
const defaultFallback = <div className="bg-accent" />;
const imgRef = useRef<HTMLImageElement>(null);

useIsomorphicLayoutEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/blocks/MobileSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function MobileSidebar(props: {
const defaultTrigger = (
<Button
className={cn(
"w-full justify-between gap-2 bg-muted/50 text-left lg:hidden",
"w-full justify-between gap-2 bg-card text-left lg:hidden",
props.triggerClassName,
)}
variant="outline"
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/blocks/SettingsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function SettingsCard(
}>,
) {
return (
<div className="relative rounded-lg border border-border bg-muted/50">
<div className="relative rounded-lg border border-border bg-card">
<div
className={cn(
"relative border-border border-b px-4 py-6 lg:px-6",
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/blocks/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function RenderSidebarLinks(props: { links: SidebarLink[] }) {
// biome-ignore lint/suspicious/noArrayIndexKey: items won't be reordered
key={i}
href={link.href}
className="flex items-center gap-2 rounded-md px-3 py-2 text-muted-foreground text-sm hover:bg-muted"
className="flex items-center gap-2 rounded-md px-3 py-2 text-muted-foreground text-sm hover:bg-accent"
activeClassName="text-foreground"
exactMatch={link.exactMatch}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/blocks/app-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function AppFooter(props: AppFooterProps) {
return (
<footer
className={cn(
"w-full border-border border-t bg-muted/50 py-6 md:py-8",
"w-full border-border border-t bg-card py-6 md:py-8",
props.className,
)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function UnexpectedValueErrorMessage(props: {
{stringifiedValue && (
<div className="mt-3">
<p className="mb-0.5 text-muted-foreground text-sm">Value Received</p>
<ScrollShadow className="rounded-lg bg-muted/50">
<ScrollShadow className="rounded-lg bg-card">
<code className="block whitespace-pre p-4 font-mono text-xs">
{stringifiedValue}
</code>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/blocks/multi-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
event.stopPropagation();
handleClear();
}}
className="rounded p-1 hover:bg-muted"
className="rounded p-1 hover:bg-accent"
>
<XIcon className="h-4 cursor-pointer text-muted-foreground" />
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/dashboard/src/@/components/blocks/pricing-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export const PricingCard: React.FC<PricingCardProps> = ({
return (
<div
className={cn(
"z-[999] flex w-full flex-col gap-6 rounded-xl border border-border bg-muted/50 p-4 md:p-6",
"z-10 flex w-full flex-col gap-6 rounded-xl border border-border bg-card p-4 md:p-6",
current && "border-blue-500",
highlighted && "border-active-border",
)}
style={
highlighted
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from "react";
import { cn } from "@/lib/utils";

const alertVariants = cva(
"dark:bg-muted/50 relative w-full rounded-lg border border-border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
"bg-card relative w-full rounded-lg border border-border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
{
variants: {
variant: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function CodeBlockContainer(props: {
return (
<div
className={cn(
"group relative max-w-full overflow-hidden rounded-lg border border-border bg-background",
"group relative max-w-full overflow-hidden rounded-lg border border-border bg-card",
props.className,
)}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/image-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ImageUpload = React.forwardRef<HTMLInputElement, ImageUploadProps>(
<div
{...getRootProps()}
className={cn(
"group relative flex cursor-pointer flex-col items-center justify-center gap-1.5 overflow-hidden rounded-md border bg-card p-4 py-6 text-muted-foreground transition-all hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
"group relative flex cursor-pointer flex-col items-center justify-center gap-1.5 overflow-hidden rounded-md border bg-background p-4 py-6 text-muted-foreground transition-all hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
isDragActive ? "border-primary" : "border-input",
!activeFile ? "w-full" : "min-h-32 min-w-32",
className,
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input bg-card px-3 py-2 text-base ring-offset-background selection:bg-foreground selection:text-background file:border-0 file:bg-transparent file:font-medium file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background selection:bg-foreground selection:text-background file:border-0 file:bg-transparent file:font-medium file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className,
)}
ref={ref}
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/radio-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const RadioGroupItemButton = React.forwardRef<
<RadioGroupPrimitive.Item
ref={ref}
className={cn(
"group flex min-w-32 cursor-pointer items-center space-x-3 space-y-0 rounded-lg border px-4 py-3 font-medium transition-all hover:border-foreground/25 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 peer-hover:border-nonce data-[state=checked]:border-muted-foreground",
"group flex min-w-32 cursor-pointer items-center space-x-3 space-y-0 rounded-lg border px-4 py-3 font-medium transition-all hover:border-foreground/25 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 peer-hover:border-nonce data-[state=checked]:border-muted-foreground",
className,
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
"flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
"flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
className,
)}
{...props}
Expand Down
4 changes: 3 additions & 1 deletion apps/dashboard/src/@/components/ui/table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ function TableDemo(props: {
<TableRow
key={invoice.invoice}
linkBox={props.linkBox}
className={cn(props.linkBox && "cursor-pointer hover:bg-muted")}
className={cn(
props.linkBox && "cursor-pointer hover:bg-accent/50",
)}
>
<TableCell className="font-medium">
<Link
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/@/components/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TableHeader = React.forwardRef<
<thead
ref={ref}
className={cn(
"border-border border-b bg-muted/50 [&_tr]:border-b",
"border-border border-b bg-background [&_tr]:border-b",
className,
)}
{...props}
Expand Down Expand Up @@ -53,7 +53,7 @@ const TableFooter = React.forwardRef<
<tfoot
ref={ref}
className={cn(
"border-border border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
"border-border border-t bg-card font-medium [&>tr]:last:border-b-0",
className,
)}
{...props}
Expand Down Expand Up @@ -128,7 +128,7 @@ TableCaption.displayName = "TableCaption";
function TableContainer(props: { children: React.ReactNode }) {
return (
<ScrollShadow
className="relative whitespace-nowrap rounded-lg border border-border"
className="relative whitespace-nowrap rounded-lg border border-border bg-card"
shadowColor="hsl(var(--muted))"
>
{props.children}
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function TabLinks(props: {
href={tab.href}
aria-disabled={tab.isDisabled}
className={cn(
"relative h-auto rounded-lg px-3 font-normal text-muted-foreground text-sm hover:bg-muted lg:text-sm",
"relative h-auto rounded-lg px-3 font-normal text-muted-foreground text-sm hover:bg-accent lg:text-sm",
!tab.isActive && !tab.isDisabled && "hover:text-foreground",
tab.isDisabled && "pointer-events-none",
tab.isActive && "!text-foreground",
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/components/ui/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
"flex min-h-[80px] w-full rounded-md border border-input bg-card px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className,
)}
ref={ref}
Expand Down
21 changes: 11 additions & 10 deletions apps/dashboard/src/@/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
:root,
[data-theme="light"] {
/* bg - neutral */
--background: 0 0% 100%;
--background: 0 0% 98%;
--popover: 0 0% 100%;
--card: 0 0% 100%;
--secondary: 0 0% 92%;
--muted: 0 0% 95%;
--accent: 0 0% 95%;
--secondary: 0 0% 90%;
--muted: 0 0% 93%;
--accent: 0 0% 93%;
--inverted: 0 0% 4%;

/* bg - colorful */
Expand All @@ -34,9 +34,10 @@
--destructive-text: 357.15deg 100% 68.72%;

/* Borders */
--border: 0 0% 80%;
--input: 0 0% 80%;
--ring: 0 0% 85%;
--border: 0 0% 85%;
--active-border: 0 0% 70%;
--input: 0 0% 85%;
--ring: 0 0% 80%;

/* Others */
--radius: 0.5rem;
Expand All @@ -46,7 +47,7 @@
[data-theme="dark"] {
/* bg - neutral */
--background: 0 0% 0%;
--card: 0 0% 0%;
--card: 0 0% 3.92%;
--popover: 0 0% 0%;
--secondary: 0 0% 11%;
--muted: 0 0% 11%;
Expand Down Expand Up @@ -74,6 +75,7 @@

/* Borders */
--border: 0 0% 15%;
--active-border: 0 0% 22%;
--ring: 0 0% 30%;
--input: 0 0% 15%;
}
Expand Down Expand Up @@ -159,13 +161,12 @@ input:-webkit-autofill:active {

.shiki,
.shiki span {
background-color: var(--background) !important;
background-color: transparent !important;
}

.dark .shiki,
.dark .shiki span {
color: var(--shiki-dark) !important;
background-color: var(--background) !important;
/* Optional, if you also want font styles */
font-style: var(--shiki-dark-font-style) !important;
font-weight: var(--shiki-dark-font-weight) !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function BuyFundsSection(props: { chain: ChainMetadata }) {
return (
<section>
<SectionTitle title="Buy Funds" />
<div className="flex justify-center rounded-lg border border-border bg-muted/30 px-4 py-10">
<div className="flex justify-center rounded-lg border border-border bg-card px-4 py-10">
<div className="flex max-w-[520px] flex-col items-center ">
<div className="flex items-center">
<ChainIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function ChainOverviewSection(props: { chain: ChainMetadata }) {
return (
<section>
<SectionTitle title="Chain Overview" />
<div className="grid grid-cols-1 gap-6 rounded-lg border bg-muted/50 p-4 md:grid-cols-2 md:p-6 lg:grid-cols-3 lg:gap-8">
<div className="grid grid-cols-1 gap-6 rounded-lg border bg-card p-4 md:grid-cols-2 md:p-6 lg:grid-cols-3 lg:gap-8">
{/* Info */}
{chain.infoURL && (
<PrimaryInfoItem title="Info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function ClaimChainSection() {
return (
<section>
<SectionTitle title="Claim Chain" />
<div className="rounded-lg border bg-muted/50 p-4">
<div className="rounded-lg border bg-card p-4">
<p className="mb-1"> This chain page is unclaimed </p>
<p className="mb-5 text-muted-foreground text-sm">
Are you the owner of this ecosystem? Claim this page to add additional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function FaucetSection(props: {
return (
<section>
<SectionTitle title="Faucet" />
<div className="flex justify-center rounded-lg border border-border bg-muted/50 px-4 py-10">
<div className="flex justify-center rounded-lg border border-border bg-card px-4 py-10">
<div className="flex w-full max-w-[520px] flex-col items-center ">
<div className="flex items-center">
<ChainIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function SupportedProductsSection(props: {
return (
<div
key={product.id}
className="relative flex gap-3 rounded-lg border bg-muted/50 p-4 pr-8 transition-colors duration-300 hover:bg-muted"
className="relative flex gap-3 rounded-lg border bg-card p-4 pr-8 transition-colors hover:border-active-border"
>
<CircleCheckIcon className="absolute top-4 right-4 size-5 text-success-text" />
<product.icon className="mt-0.5 size-5 shrink-0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function ExplorersSection(props: {
return (
<div
key={explorer.url}
className="relative rounded-xl border bg-muted/50 p-4 hover:bg-muted"
className="relative rounded-xl border bg-card p-4 transition-colors hover:border-active-border"
>
<ExternalLinkIcon className="absolute top-4 right-4 size-4 text-muted-foreground" />
<h3 className="mb-1 font-semibold text-base capitalize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
<Tr
{...row.getRowProps()}
role="group"
className="hover:bg-muted/50"
className="hover:bg-card"
style={{ cursor: "pointer" }}
onClick={() => setTokenRow(row.original)}
borderBottomWidth={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const SnapshotViewerSheetContent: React.FC<SnapshotUploadProps> = ({
<div
className={cn(
"flex h-full cursor-pointer rounded-md border border-border hover:border-primary",
noCsv ? "bg-red-200" : "bg-card",
noCsv ? "bg-red-200" : "bg-background",
)}
{...getRootProps()}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
{chain && (
<Link
href={`/${chain.slug}`}
className="flex w-fit shrink-0 items-center gap-2 rounded-3xl border border-border bg-muted/50 px-2.5 py-1.5 hover:bg-muted"
className="flex w-fit shrink-0 items-center gap-2 rounded-3xl border border-border bg-card px-2.5 py-1.5 hover:bg-accent"
>
<ChainIcon ipfsSrc={chain.icon?.url} className="size-4" />
{cleanedChainName && (
Expand All @@ -109,7 +109,7 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
<CopyAddressButton
address={address}
copyIconPosition="left"
className="bg-muted/50 text-xs"
className="bg-card text-xs"
variant="outline"
/>

Expand Down Expand Up @@ -138,7 +138,7 @@ function BadgeLink(props: {
<Button
variant="outline"
asChild
className="!h-auto gap-2 rounded-lg bg-muted/50 px-3 py-1.5 text-xs capitalize"
className="!h-auto gap-2 rounded-lg bg-card px-3 py-1.5 text-xs capitalize"
>
<Link href={props.href} target="_blank">
{props.name}
Expand Down
Loading

0 comments on commit be7759d

Please sign in to comment.