<commit_before>import React from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import styles from './image-caption.module.scss';

const ImageCaption = ({ src, alt, centered, width, height, children }) => {
    const { allFile: { nodes } } = useStaticQuery(graphql`
    {
        allFile(filter: { sourceInstanceName: { eq: "pages" }, relativePath: { regex: "/(?:.jpg|.jpg|png|.svg|.gif)$/" } }) {
            nodes {
                relativePath
                childImageSharp {
                    fluid {
                        src
                    }
                }
            }
        }
    }
    `);

    const img = nodes.filter(file => file.relativePath === src)[0];
    const style = {};

    if (width != null) { style.width = width; }
    if (height != null) { style.height = height; }

    const className = `${styles.imageCaption} ${centered ? styles.imageCaptionCentered : ''}`;

    return (
        <div className={className} style={style}>
            <img src={img.childImageSharp.fluid.src} className={styles.imageCaption__top} alt={alt} /><commit_msg>AG-4632 - use public URL for GIFs in ImageCaption<commit_after>import React from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import styles from './image-caption.module.scss';

const ImageCaption = ({ src, alt, centered, width, height, children }) => {
    const { allFile: { nodes } } = useStaticQuery(graphql`
    {
        allFile(filter: { sourceInstanceName: { eq: "pages" }, relativePath: { regex: "/(?:.jpg|.jpg|png|.svg|.gif)$/" } }) {
            nodes {
                relativePath
                publicURL
                childImageSharp {
                    fluid {
                        src
                    }
                }
            }
        }
    }
    `);

    const img = nodes.filter(file => file.relativePath === src)[0];
    const style = {};

    if (width != null) { style.width = width; }
    if (height != null) { style.height = height; }

    const className = `${styles.imageCaption} ${centered ? styles.imageCaptionCentered : ''}`;

    return (
        <div className={className} style={style}>
            <img src={img.childImageSharp == null ? img.publicURL : img.childImageSharp.fluid.src} className={styles.imageCaption__top} alt={alt} />
{'fraction_non_alphanumeric': 0.1457242582897033, 'fraction_numerical': 0.002617801047120419, 'mean_word_length': 2.0902964959568733, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4265817', 'n_tokens_mistral': 673, 'n_tokens_neox': 645, 'n_words': 145}