Rename SideMenu to NavMenu, fix tooltips, and update react-zen.
- Rename SideMenu to NavMenu with visible group title labels and selected item highlighting - Update react-zen to 0.242.0 and fix responsive breakpoints (xs -> base) - Style floating tooltips with inverted background across WorldMap, charts, and WeeklyTraffic - Add CSS variables for primary color and use IconLabel consistently - Remove stray console.log from LoadingPanel Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
7cafc3e61d
commit
c6dd3fb6ff
36 files changed
+107
-171
No files matched your search
@@ -65,7 +65,7 @@ export function FilterRecord({
|
||||
<Column>
|
||||
<Label>{fields.find(f => f.name === name)?.label}</Label>
|
||||
<Grid columns="1fr auto" gap>
|
||||
<Grid columns={{ xs: '1fr', md: '200px 1fr' }} gap>
|
||||
<Grid columns={{ base: '1fr', md: '200px 1fr' }} gap>
|
||||
<Select
|
||||
items={operators.filter(({ type }) => type === 'string')}
|
||||
value={operator}
|
||||
|
||||
@@ -4,18 +4,18 @@ const LAYOUTS = {
|
||||
one: { columns: '1fr' },
|
||||
two: {
|
||||
columns: {
|
||||
xs: '1fr',
|
||||
base: '1fr',
|
||||
md: 'repeat(auto-fill, minmax(560px, 1fr))',
|
||||
},
|
||||
},
|
||||
three: {
|
||||
columns: {
|
||||
xs: '1fr',
|
||||
base: '1fr',
|
||||
md: 'repeat(auto-fill, minmax(360px, 1fr))',
|
||||
},
|
||||
},
|
||||
'one-two': { columns: { xs: '1fr', md: 'repeat(3, 1fr)' } },
|
||||
'two-one': { columns: { xs: '1fr', md: 'repeat(3, 1fr)' } },
|
||||
'one-two': { columns: { base: '1fr', md: 'repeat(3, 1fr)' } },
|
||||
'two-one': { columns: { base: '1fr', md: 'repeat(3, 1fr)' } },
|
||||
};
|
||||
|
||||
export function GridRow(props: {
|
||||
|
||||
@@ -29,8 +29,6 @@ export function LoadingPanel({
|
||||
}: LoadingPanelProps): ReactNode {
|
||||
const empty = isEmpty ?? checkEmpty(data);
|
||||
|
||||
console.log({ empty, isEmpty, data });
|
||||
|
||||
// Show loading spinner only if no data exists
|
||||
if (isLoading || isFetching) {
|
||||
return (
|
||||
|
||||
@@ -2,39 +2,46 @@ import { Column, Heading, Row, Text } from '@umami/react-zen';
|
||||
import Link from 'next/link';
|
||||
import { IconLabel } from '@/components/common/IconLabel';
|
||||
|
||||
interface SideMenuData {
|
||||
interface NavMenuData {
|
||||
id: string;
|
||||
label: string;
|
||||
icon?: any;
|
||||
path: string;
|
||||
}
|
||||
|
||||
interface SideMenuItems {
|
||||
interface NavMenuItems {
|
||||
label?: string;
|
||||
items: SideMenuData[];
|
||||
items: NavMenuData[];
|
||||
}
|
||||
|
||||
export interface SideMenuProps {
|
||||
items: SideMenuItems[];
|
||||
export interface NavMenuProps {
|
||||
items: NavMenuItems[];
|
||||
title?: string;
|
||||
selectedKey?: string;
|
||||
allowMinimize?: boolean;
|
||||
onItemClick?: () => void;
|
||||
}
|
||||
|
||||
export function SideMenu({
|
||||
export function NavMenu({
|
||||
items = [],
|
||||
title,
|
||||
selectedKey,
|
||||
allowMinimize,
|
||||
onItemClick,
|
||||
...props
|
||||
}: SideMenuProps) {
|
||||
const renderItems = (items: SideMenuData[]) => {
|
||||
}: NavMenuProps) {
|
||||
const renderItems = (items: NavMenuData[]) => {
|
||||
return items?.map(({ id, label, icon, path }) => {
|
||||
const isSelected = selectedKey === id;
|
||||
|
||||
return (
|
||||
<Link key={id} href={path}>
|
||||
<Row padding borderRadius hover={{ backgroundColor: 'surface-raised' }}>
|
||||
<Link key={id} href={path} onClick={onItemClick}>
|
||||
<Row
|
||||
padding
|
||||
borderRadius
|
||||
hover={{ backgroundColor: 'surface-sunken' }}
|
||||
backgroundColor={isSelected ? 'surface-sunken' : undefined}
|
||||
>
|
||||
<IconLabel icon={icon}>
|
||||
<Text weight={isSelected ? 'bold' : 'normal'}>{label}</Text>
|
||||
</IconLabel>
|
||||
@@ -45,13 +52,7 @@ export function SideMenu({
|
||||
};
|
||||
|
||||
return (
|
||||
<Column
|
||||
gap
|
||||
overflowY="auto"
|
||||
justifyContent="space-between"
|
||||
position="sticky"
|
||||
backgroundColor="surface-base"
|
||||
>
|
||||
<Column gap overflowY="auto" justifyContent="space-between" position="sticky">
|
||||
{title && (
|
||||
<Row padding>
|
||||
<Heading size="sm">{title}</Heading>
|
||||
@@ -61,13 +62,10 @@ export function SideMenu({
|
||||
{items?.map(({ label, items }, index) => {
|
||||
if (label) {
|
||||
return (
|
||||
<Column
|
||||
title={label}
|
||||
key={`${label}${index}`}
|
||||
gap="1"
|
||||
marginBottom="3"
|
||||
minHeight="40px"
|
||||
>
|
||||
<Column key={`${label}${index}`} gap="1" marginBottom="3" minHeight="40px">
|
||||
<Row padding>
|
||||
<Text weight="bold">{label}</Text>
|
||||
</Row>
|
||||
{renderItems(items)}
|
||||
</Column>
|
||||
);
|
||||
@@ -34,7 +34,7 @@ export function PageBody({
|
||||
minHeight="100vh"
|
||||
paddingBottom="6"
|
||||
maxWidth={maxWidth}
|
||||
paddingX={{ xs: '3', md: '6' }}
|
||||
paddingX={{ base: '3', md: '6' }}
|
||||
style={{ margin: '0 auto' }}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in new issue
Block a user