From 1b74231da3fe51b9a54b32d0eca0974aebf934bc Mon Sep 17 00:00:00 2001 From: Richard Ward Date: Tue, 30 Dec 2025 18:01:40 +0000 Subject: [PATCH] code: tsx,nextjs,frontends (3 files) --- .../molecules/tabs/components/TabsContent.tsx | 14 +++--- .../molecules/tabs/components/TabsTrigger.tsx | 44 ++++--------------- .../ui/molecules/tabs/core/Tabs.tsx | 19 +++++--- 3 files changed, 30 insertions(+), 47 deletions(-) diff --git a/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsContent.tsx b/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsContent.tsx index a5e6cc991..56081d0f1 100644 --- a/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsContent.tsx +++ b/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsContent.tsx @@ -1,17 +1,17 @@ 'use client' -import type { BoxProps } from '@mui/material' -import { Box } from '@mui/material' +import { Box } from '@fakemui/layout/Box' +import type { BoxProps } from '@fakemui/layout/Box' import { forwardRef, useContext } from 'react' import { TabsContext } from '../core/tabs-context' -export interface TabsContentProps extends BoxProps { +export interface TabsContentProps extends Omit { value: string } const TabsContent = forwardRef( - ({ children, value, sx, ...props }, ref) => { + ({ children, value, style, ...props }, ref) => { const context = useContext(TabsContext) if (!context) { @@ -22,16 +22,16 @@ const TabsContent = forwardRef( return ( } role="tabpanel" id={`${context.idPrefix}-panel-${value}`} aria-labelledby={`${context.idPrefix}-tab-${value}`} hidden={!isActive} - sx={{ + style={{ flex: 1, outline: 'none', display: isActive ? 'block' : 'none', - ...sx, + ...style, }} {...props} > diff --git a/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsTrigger.tsx b/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsTrigger.tsx index 8044e0df9..aacdcc015 100644 --- a/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsTrigger.tsx +++ b/frontends/nextjs/src/components/ui/molecules/tabs/components/TabsTrigger.tsx @@ -1,18 +1,19 @@ 'use client' -import type { BoxProps } from '@mui/material' -import { Box } from '@mui/material' -import type { MouseEvent } from 'react' +import { Box } from '@fakemui/layout/Box' +import type { MouseEvent, CSSProperties, ButtonHTMLAttributes } from 'react' import { forwardRef, useContext } from 'react' import { TabsContext } from '../core/tabs-context' +import styles from './TabsTrigger.module.scss' -export interface TabsTriggerProps extends BoxProps<'button'> { +export interface TabsTriggerProps extends Omit, 'ref'> { value: string + style?: CSSProperties } const TabsTrigger = forwardRef( - ({ children, value, onClick, disabled, sx, ...props }, ref) => { + ({ children, value, onClick, disabled, style, className, ...props }, ref) => { const context = useContext(TabsContext) if (!context) { @@ -31,7 +32,7 @@ const TabsTrigger = forwardRef( return ( } component="button" type="button" role="tab" @@ -43,35 +44,8 @@ const TabsTrigger = forwardRef( data-state={isSelected ? 'active' : 'inactive'} data-value={value} onClick={handleClick} - sx={{ - display: 'inline-flex', - alignItems: 'center', - justifyContent: 'center', - whiteSpace: 'nowrap', - px: 2, - py: 0.75, - fontSize: '0.875rem', - fontWeight: 500, - borderRadius: 1.5, - border: 0, - bgcolor: 'transparent', - color: 'text.secondary', - cursor: 'pointer', - transition: 'all 0.15s', - '&:hover': { - color: 'text.primary', - }, - '&[aria-selected="true"]': { - bgcolor: 'background.paper', - color: 'text.primary', - boxShadow: 1, - }, - '&:disabled': { - opacity: 0.5, - cursor: 'not-allowed', - }, - ...sx, - }} + className={`${styles.tabsTrigger} ${className ?? ''}`} + style={style} {...props} > {children} diff --git a/frontends/nextjs/src/components/ui/molecules/tabs/core/Tabs.tsx b/frontends/nextjs/src/components/ui/molecules/tabs/core/Tabs.tsx index 9ce4eb289..98a40501c 100644 --- a/frontends/nextjs/src/components/ui/molecules/tabs/core/Tabs.tsx +++ b/frontends/nextjs/src/components/ui/molecules/tabs/core/Tabs.tsx @@ -1,19 +1,19 @@ 'use client' -import type { BoxProps } from '@mui/material' -import { Box } from '@mui/material' +import { Box } from '@fakemui/layout/Box' +import type { BoxProps } from '@fakemui/layout/Box' import { forwardRef, useId, useState } from 'react' import { TabsContext } from './tabs-context' -export interface TabsProps extends BoxProps { +export interface TabsProps extends Omit { defaultValue?: string value?: string onValueChange?: (value: string) => void } const Tabs = forwardRef( - ({ children, defaultValue, value, onValueChange, sx, ...props }, ref) => { + ({ children, defaultValue, value, onValueChange, style, ...props }, ref) => { const [internalValue, setInternalValue] = useState(defaultValue ?? '') const currentValue = value ?? internalValue const idPrefix = useId() @@ -27,7 +27,16 @@ const Tabs = forwardRef( return ( - + } + style={{ + display: 'flex', + flexDirection: 'column', + gap: '16px', + ...style, + }} + {...props} + > {children}