{"size": 1434, "ext": "js", "max_stars_repo_path": "src/components/Posts.js", "max_stars_repo_name": "smyrick/expediagroup.github.io", "max_stars_repo_stars_event_min_datetime": "2019-09-19T06:24:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T00:53:47.000Z", "max_issues_repo_path": "src/components/Posts.js", "max_issues_repo_name": "smyrick/expediagroup.github.io", "max_issues_repo_issues_event_min_datetime": "2021-03-22T16:58:01.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-26T09:30:05.000Z", "max_forks_repo_path": "src/components/Posts.js", "max_forks_repo_name": "smyrick/expediagroup.github.io", "max_forks_repo_forks_event_min_datetime": "2021-07-06T17:19:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-14T08:23:51.000Z"}
{"max_stars_count": 22, "max_issues_count": 14, "max_forks_count": 3, "avg_line_length": 30.5106382979, "max_line_length": 72, "alphanum_fraction": 0.589958159}
/*
Copyright 2021 Expedia, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import styles from './Posts.module.css';
import useScript from 'react-script-hook';

function Posts({link}) {
    useScript({
        src: "https://medium-widget.pixelpoint.io/widget.js",
        onload: () => {
            MediumWidget.Init({
                renderTo: `.${styles.mediumWidgetPosts}`,
                params: {
                    "resource": `${link}`,
                    "postsPerLine": 1,
                    "limit": 10,
                    "picture": "small",
                    "fields": ["description", "author", "publishAt"],
                    "ratio": "square"
                }})
        }
    });
    return (
        <div className={styles.mediumWidget}>
            <div className={styles.mediumWidgetPosts}>
                <h3>Loading posts..</h3>
            </div>
        </div>
    );
}

export default Posts;
