/** @jsxImportSource @emotion/react */ import { css } from '@emotion/react'; import { useState, useEffect } from 'react'; import { RcIconAngleDown, RcIconAngleUp } from '../icons'; export interface RcCollapseProps { title: string; fontSize?: string; iconSize?: string; width?: string; height?: string; paddingHoriz?: string; iconPaddingRight?: string; color?: string; bgColor?: string; borderColor?: string; titleBgColor?: string; titleBorderColor?: string; closeOnClickBody?: boolean; initShow?: boolean; cssTitle?: string; } export const RcCollapse: React.FC = ({ title, fontSize = '18px', iconSize = '18px', width, height = '50px', paddingHoriz = '20px', iconPaddingRight = '15px', color = '#484848', bgColor = '#ffffff', borderColor = '#cccccc', titleBgColor, titleBorderColor, closeOnClickBody = true, initShow = false, cssTitle, children, }) => { const [show, setShow] = useState(false); useEffect(() => { setShow(!!initShow); }, [initShow]); return (
closeOnClickBody && setShow(!show)} >
setShow(!show)} > {cssTitle ? {title} : {title}}
{children}
{borderColor && !titleBorderColor && (
)}
setShow(!show)} > {show ? : }
); };