import type { AriaAttributes, ReactNode } from 'react' import React, { forwardRef } from 'react' import { Icon, List, SROnly } from '../../index' type Flag = { icon: { icon: string } alt: string } export interface PaymentMethodsProps { /** * ID to find this component in testing tools (e.g.: cypress, * testing-library, and jest). */ testId?: string /** * Title of the payment methods section (e.g.: "Payment methods", * "Accepted Cards"). */ title?: ReactNode /** * Defines a string value that labels the current element when * title is not used. */ 'aria-label'?: AriaAttributes['aria-label'] /** * List of flags to be displayed in the payment * methods section (e.g.:, visa, mastercard, etc). */ flagList: Flag[] } const PaymentMethods = forwardRef( function PaymentMethods( { testId = 'fs-payment-methods', title, 'aria-label': ariaLabel = 'Payment Methods', flagList, ...otherProps }, ref ) { return (
{/* TODO: We can consider removing and make title always required or add it via heading */} {!!title && (
{title}
)} {flagList.map(({ alt: text, icon: { icon } }, index) => (
  • {text && }
  • ))}
    ) } ) export default PaymentMethods