Files
js/apps/dashboard/src/theme/index.ts
T
jnsdls e372a3f413 pay dashboard (#3393)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates package versions, improves UI components, enhances styling, and refactors URLs for consistency.

### Detailed summary
- Updated `pnpm` to version `9.4.0`
- Enhanced UI components like `Button`, `ScrollShadow`, `Badge`, and `Skeleton`
- Refactored URLs for consistency
- Improved styling and transitions in various components

> The following files were skipped due to too many changes: `apps/dashboard/src/@/components/ui/DynamicHeight.tsx`, `apps/dashboard/src/theme/index.ts`, `apps/dashboard/src/contract-ui/tabs/overview/components/Analytics.tsx`, `apps/dashboard/src/@/components/ui/CopyAddressButton.tsx`, `apps/dashboard/src/components/analytics/custom-tooltip.tsx`, `apps/dashboard/src/contract-ui/tabs/analytics/page.tsx`, `apps/dashboard/src/pages/_app.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/hooks/usePayNewCustomers.ts`, `apps/dashboard/src/components/analytics/stack-tooltip.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/ExportToCSVButton.tsx`, `apps/dashboard/src/@/components/pagination-buttons.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/hooks/usePayCustomers.ts`, `apps/dashboard/src/components/pay/PayAnalytics/hooks/usePayVolume.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/client/pagination.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/hooks/usePayPurchases.ts`, `apps/dashboard/src/@/components/ui/calendar.tsx`, `apps/dashboard/src/@/styles/globals.css`, `apps/dashboard/src/components/pay/PayAnalytics/components/common.tsx`, `apps/dashboard/src/@/components/ui/DatePickerWithRange.tsx`, `apps/dashboard/src/@/components/ui/use-toast.ts`, `apps/dashboard/src/components/analytics/area-chart.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/TotalVolumePieChart.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PaymentsSuccessRate.tsx`, `apps/dashboard/src/@/components/ui/tabs.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/Payouts.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PayNewCustomers.tsx`, `apps/dashboard/src/@/components/ui/toast.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/PayAnalytics.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/TotalPayVolume.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PayCustomersTable.tsx`, `apps/dashboard/src/pages/dashboard/connect/pay.tsx`, `apps/dashboard/src/components/analytics/bar-chart.tsx`, `apps/dashboard/src/@/components/ui/select.tsx`, `apps/dashboard/src/components/analytics/auto-bar-chart.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PaymentHistory.tsx`, `pnpm-lock.yaml`

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

<!-- end pr-codex -->
2024-06-23 16:11:16 +00:00

420 lines
10 KiB
TypeScript

import { type Theme, extendTheme } from "@chakra-ui/react";
import { getColor, mode } from "@chakra-ui/theme-tools";
import { skeletonTheme } from "./chakra-componens/skeleton";
import { colors } from "./colors";
import { fontWeights, letterSpacings, lineHeights } from "./typography";
const chakraTheme: Theme = extendTheme({
config: {
initialColorMode: "dark",
useSystemColorMode: false,
} as Theme["config"],
fonts: {
heading: "Inter, sans-serif",
body: "Inter, sans-serif",
mono: "IBM Plex Mono, monospace",
},
styles: {
global: {
"html, body": {
background: "#000",
padding: 0,
margin: 0,
fontFeatureSettings: `'zero' 1`,
scrollBehavior: "smooth",
},
body: {
colorScheme: "dark",
},
"::selection": {
backgroundColor: "#90cdf4",
color: "#fefefe",
},
"::-moz-selection": {
backgroundColor: "#90cdf4",
color: "#fefefe",
},
},
},
components: {
Skeleton: skeletonTheme,
Heading: {
baseStyle: {
color: "heading",
},
},
Text: {
baseStyle: {
color: "paragraph",
},
},
Divider: {
baseStyle: {
borderColor: "borderColor",
},
},
Badge: {
baseStyle: {
backgroundColor: "badgeBg",
},
},
Button: {
baseStyle: {
borderRadius: "md",
},
variants: {
// biome-ignore lint/suspicious/noExplicitAny: FIXME
gradient: (props: any) => {
const { theme, fromcolor, tocolor } = props;
const lgFrom = getColor(theme, fromcolor);
const lgTo = getColor(theme, tocolor);
const bgColor = getColor(theme, mode("white", "gray.800")(props));
return {
border: "3px solid",
borderColor: "transparent",
borderRadius: "md",
background: `linear-gradient(${bgColor}, ${bgColor}) padding-box,
linear-gradient(135deg, ${lgFrom}, ${lgTo}, ${lgFrom}) border-box`,
transitionProperty: "opacity, background",
transitionDuration: "slow",
backgroundSize: "200%",
"> *": {
transitionProperty: "background",
transitionDuration: "slow",
transitionTimingFunction: "easeOut",
background: `linear-gradient(135deg, ${lgFrom}, ${lgTo}, ${lgFrom})`,
backgroundSize: "200%",
backgroundClip: "text",
textFillColor: "transparent",
},
_hover: {
backgroundPosition: "right",
"> *": {
backgroundPosition: "right",
},
opacity: 0.9,
},
};
},
// biome-ignore lint/suspicious/noExplicitAny: FIXME
highlighted: (props: any) => ({
bg: "#151515",
_hover: {
boxShadow: "0 0 10px 2px rgba(51, 133, 255, 1)",
transform: "scale(1.05)",
},
size: "lg",
borderRadius: props.fullCircle ? "full" : "12px",
}),
inverted: {
bg: "bgBlack",
color: "bgWhite",
_hover: {
opacity: 0.8,
},
_disabled: {
_hover: {
bg: "bgBlack !important",
},
},
},
outline: {
borderWidth: "1px",
borderColor: "inputBorder",
_hover: {
bg: "transparent",
borderColor: "inputBorderHover",
},
},
},
},
Modal: {
baseStyle: {
overlay: {
backdropFilter: "blur(5px)",
},
dialog: {
background: "backgroundHighlight",
},
},
},
Drawer: {
baseStyle: {
overlay: {
backdropFilter: "blur(5px)",
},
dialog: {
background: "backgroundHighlight",
},
},
},
Select: {
defaultProps: {
variant: "filled",
},
variants: {
filled: {
field: {
borderWidth: "1px",
borderColor: "borderColor",
background: "inputBg",
_hover: {
background: "inputBgHover",
borderColor: "blue.500",
},
},
},
},
},
Input: {
defaultProps: {
variant: "filled",
},
variants: {
filled: {
field: {
borderWidth: "1px",
borderColor: "inputBorder",
background: "transparent",
_hover: {
borderColor: "inputBorderHover",
background: "transparent",
},
_focus: {
borderColor: "blue.500",
},
},
},
},
sizes: {
xl: {
field: {
fontSize: "lg",
px: 4,
h: 14,
borderRadius: "md",
},
addon: {
fontSize: "lg",
px: 4,
h: 14,
borderRadius: "md",
},
},
},
},
NumberInput: {
defaultProps: {
variant: "filled",
},
variants: {
filled: {
field: {
borderWidth: "1px",
borderColor: "inputBorder",
background: "inputBg",
_hover: {
background: "inputBgHover",
borderColor: "blue.500",
},
_invalid: {
borderColor: "inputBorder",
},
},
},
},
sizes: {
xl: {
field: {
fontSize: "lg",
px: 4,
h: 14,
borderRadius: "md",
},
addon: {
fontSize: "lg",
px: 4,
h: 14,
borderRadius: "md",
},
},
},
},
Textarea: {
defaultProps: {
variant: "filled",
},
variants: {
filled: {
borderWidth: "1px",
borderColor: "inputBorder",
background: "transparent",
_hover: {
borderColor: "inputBorderHover",
background: "transparent",
},
_focus: {
borderColor: "blue.500",
},
},
},
},
Menu: {
baseStyle: {
list: {
bg: "backgroundHighlight",
py: 0,
borderWidth: 1,
borderColor: "borderColor",
borderRadius: "lg",
overflow: "hidden",
},
item: {
bg: "backgroundHighlight",
_hover: {
bg: "accent.200",
},
py: 3,
},
},
},
Table: {
baseStyle: {
thead: {
background: "backgroundHighlight",
borderBottomColor: "accent.100",
borderBottomWidth: 1,
},
tbody: {
background: "backgroundHighlight",
},
cell: {
borderColor: "borderColor",
},
},
sizes: {
md: {
td: {
py: 2,
px: 6,
borderBottom: "none",
fontSize: "14px",
},
th: {
py: 4,
fontSize: "12px",
color: "faded",
borderBottom: "none",
fontWeight: "600",
},
},
},
},
},
colors,
fontSizes: [],
fontWeights,
lineHeights,
letterSpacings,
sizes: {
container: {
page: "1170px",
hero: "1440px",
},
},
semanticTokens: {
colors: {
// accent color
"accent.100": {
default: "gray.100",
_dark: "gray.900",
},
"accent.200": {
default: "gray.200",
_dark: "gray.800",
},
"accent.300": {
default: "gray.300",
_dark: "gray.700",
},
"accent.400": {
default: "gray.400",
_dark: "gray.600",
},
"accent.500": {
default: "gray.500",
_dark: "gray.500",
},
"accent.600": {
default: "gray.600",
_dark: "gray.400",
},
"accent.700": {
default: "gray.700",
_dark: "gray.300",
},
"accent.800": {
default: "gray.800",
_dark: "gray.200",
},
"accent.900": {
default: "gray.900",
_dark: "gray.100",
},
// inputs
inputBg: { default: "gray.50", _dark: "whiteAlpha.50" },
inputBgHover: { default: "gray.100", _dark: "whiteAlpha.100" },
inputBorder: { default: "gray.200", _dark: "#272B30" },
inputBorderHover: { default: "gray.300", _dark: "whiteAlpha.50" },
// other
badgeBg: { default: "blackAlpha.50", _dark: "whiteAlpha.50" },
// backgroundBody: "accent.100",
// backgroundHighlight: { default: "white", _dark: "accent.200" },
// backgroundCardHighlight: { default: "white", _dark: "accent.100" },
// backgroundNavbar: { default: "white", _dark: "accent.200" },
// wordmark: { default: "#262A36", _dark: "whiteAlpha.900" },
// heading: { default: "black", _dark: "white" },
// paragraph: "accent.800",
// borderColor: { default: "accent.200", _dark: "accent.300" },
bgBlack: { default: "black", _dark: "white" },
bgWhite: { default: "#fff", _dark: "black" },
backgroundBody: {
default: "hsl(var(--background))",
_dark: "hsl(var(--background))",
},
backgroundHighlight: {
default: "hsl(var(--secondary))",
_dark: "hsl(var(--secondary))",
},
secondaryCardHighlight: {
default: "hsl(var(--secondary))",
_dark: "hsl(var(--secondary))",
},
wordmark: { default: "#262A36", _dark: "whiteAlpha.900" },
heading: { default: "#262A36", _dark: "#ECECEC" },
paragraph: { default: "rgba(39, 46, 54, 0.9)", _dark: "#b2b2b2" },
faded: {
default: "hsl(var(--muted-foreground))",
_dark: "hsl(var(--muted-foreground))",
},
headingLight: { default: "#F2FBFF", _dark: "#262A36" },
paragraphLight: {
default: "rgba(242, 251, 255, 0.8)",
_dark: "rgba(39, 46, 54, 0.9)",
},
borderColor: { default: "gray.200", _dark: "#2B2B2B" },
opaqueBg: {
default: "whiteAlpha.500",
_dark: "blackAlpha.600",
},
},
},
}) as Theme;
export default chakraTheme;