import tw from '../../../tw'; import BlockTitle from '../../Internal/BlockTitle'; import { CardAction, CardProps } from '../types'; import useLocalizedText from '../../../useLocalizedText'; import { truncate } from '../../../utils/truncate'; import CarouselNavigation from '../CarouselNavigation'; import CardButton from '../CardButton'; interface ActionsProps extends CardProps {} const getBgClassName = (bgColor: CardAction['backgroundColor']) => { switch (bgColor) { case 'white': case 'transparent-white': return tw`text-white bg-[rgba(255,255,255,0.1)]`; case 'black': case 'transparent-black': default: return tw`text-black bg-[rgba(0,0,0,0.05)]`; } }; const getBtnClassName = (bgColor: CardAction['backgroundColor']) => { switch (bgColor) { case 'white': case 'transparent-white': return tw`text-white border border-solid border-white bg-transparent`; case 'black': case 'transparent-black': default: return tw`text-black bg-white`; } }; const Actions = ({ title, styles, cards, container, getCoverStyle, canScroll, scroll, className = '', }: ActionsProps) => { const { localize } = useLocalizedText(); return (
{title && }
{(cards as CardAction[]).map( ( { title, description, cover, content = [], backgroundColor }, index ) => (
{getCoverStyle(index) && (
)}
{truncate( localize(title), getCoverStyle(index) ? 14 : 25 )}
{truncate( localize(description), getCoverStyle(index) ? 43 : 80 )}
{content && Array.isArray(content) && content.slice(0, 3).map((item, index) => (
))}
) )}
); }; export default Actions;