import React from 'react';
import './index.css'

const a = (props: any) => {
  return (
    <>
      {
        '@ifr' === props?.title?.split(/\s/g)?.[0] ? (
          <span className='readerText-a' onClick={() => {
            window.postMessage({
              type: 'pushContainer',
              component: 'Webview',
              value: {
                path: props?.href,
                name: '网页'
              }
            }, '*')
          }}>{props?.children ? props?.children[0] : ''}</span>
        ) : (
          <a href={props?.href} target={props?.target || '_blank'}>
            {props?.children ? props?.children[0] : ''}
          </a>
        )
      }
    </>
  );
};

export default a;
