import { memo } from 'react';
import LinearGradient from 'react-native-linear-gradient';
import { ComponentID, ElementID, PageID } from '../../enums';
import { Image, View } from 'react-native';
import { useStyles } from './styles';
import { Typography } from '../../../core/components/Typography/Typography';
import { SvgXml } from 'react-native-svg';
import { community as communityIcon } from '../../../core/assets/icons';
import { getFileUrlWithSize } from '../../utils';
import { useAmityElement } from '../../hooks';
const CommunityRowImagey = ({
  fileUrl,
  pageId = PageID.WildCardPage,
  componentId = ComponentID.WildCardComponent,
  label
}) => {
  const elementId = ElementID.community_row_image;
  const styles = useStyles();
  const {
    accessibilityId
  } = useAmityElement({
    pageId,
    componentId,
    elementId
  });
  return /*#__PURE__*/React.createElement(View, {
    testID: accessibilityId,
    style: styles.container
  }, fileUrl ? /*#__PURE__*/React.createElement(Image, {
    source: {
      uri: getFileUrlWithSize(fileUrl)
    },
    style: styles.image,
    resizeMode: "cover"
  }) : /*#__PURE__*/React.createElement(View, {
    style: styles.placeholder
  }, /*#__PURE__*/React.createElement(SvgXml, {
    xml: communityIcon(),
    width: 36,
    height: 22
  })), label && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinearGradient, {
    colors: ['rgba(0, 0, 0, 0.4)', 'rgba(0, 0, 0, 0)', 'transparent'],
    style: styles.gradientLayer,
    start: {
      x: 0,
      y: 1
    },
    end: {
      x: 0,
      y: 0
    }
  }), /*#__PURE__*/React.createElement(Typography.BodyBold, {
    style: styles.label
  }, label)));
};
export default /*#__PURE__*/memo(CommunityRowImagey);
//# sourceMappingURL=CommunityRowImage.js.map