import * as React from 'react'; import { useContext } from 'react'; import { Typography } from 'antd'; import { useTheme } from 'antd-style'; import SiteContext from '../../../theme/slots/SiteContext'; export interface GroupMaskProps { style?: React.CSSProperties; children?: React.ReactNode; disabled?: boolean; onMouseMove?: React.MouseEventHandler; onMouseEnter?: React.MouseEventHandler; onMouseLeave?: React.MouseEventHandler; } export const GroupMask: React.FC = (props) => { const { children, style, disabled, onMouseMove, onMouseEnter, onMouseLeave } = props; const additionalStyle: React.CSSProperties = disabled ? {} : { position: 'relative', zIndex: 1, }; return (
{children}
); }; export interface GroupProps { id?: string; title?: React.ReactNode; titleColor?: string; description?: React.ReactNode; children?: React.ReactNode; background?: string; /** 是否不使用两侧 margin */ collapse?: boolean; decoration?: React.ReactNode; } const Group: React.FC = (props) => { const { id, title, titleColor, description, children, decoration, background, collapse } = props; const token = useTheme(); const { isMobile } = useContext(SiteContext); const marginStyle: React.CSSProperties = collapse ? {} : { maxWidth: 1208, marginInline: 'auto', boxSizing: 'border-box', paddingInline: isMobile ? token.margin : token.marginXXL, }; const childNode = ( <>
{title} {description}
{children ? (
{children}
) : (
)}
); return (
{decoration}
{childNode}
); }; export default Group;