# All files / composer/components InstagramFeedback.jsx

33.33% Statements 3/9
0% Branches 0/2
0% Functions 0/4
37.5% Lines 3/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

    1x

    1x

    1x

     import React from 'react';
    import PropTypes from 'prop-types';
    import styles from './css/InstagramFeedback.css';
    import InstagramReminderIcon from './InstagramReminderIcon';

    const getLinkUrl = (feedback) => {
      if (feedback.some((f) => f.code === 'ASPECT_RATIO')) {
        return 'https://faq.buffer.com/article/951-publish-image-aspect-ratios-for-instagram-direct-scheduling';
      }
      return 'https://faq.buffer.com/article/950-publish-how-buffer-works-with-instagram';
    };

    const InstagramFeedback = ({ feedback }) => (
      <div className={styles.container}>
        <div className={styles.iconContainer}>
          <InstagramReminderIcon size={{ width: '24px', height: '24px' }} />
        </div>
        <div className={styles.feedbackContainer}>
          {feedback.map((item) => <p key={item.code} className={styles.item}>{item.message} </p>)}
          <a className={styles.link} target="_blank" href={getLinkUrl(feedback)}>Learn more</a>
        </div>
      </div>
    );

    InstagramFeedback.propTypes = {
      feedback: PropTypes.array.isRequired,
    };

    export default InstagramFeedback;