npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mediumpostscard

v2.0.5

Published

React Isomorphic library that show your Medium articles.

Downloads

7

Readme

CSR SSR Licence


📝 Table of Contents

About

Are you looking for a React library to display your medium posts that render both the client side and on the server side? So you are in the right place! Medium Posts Card get your medium articles, and displays them on your website through an easy to use component. Just download and use, as simple as that.

Install

Install this library with one of the commands below

yarn add mediumpostscard

//or

npm install mediumpostscard

Components

Carousel

import { Carousel } from 'mediumpostscard'

function Example(){
  return (
    <Carousel username="alex.streza" />
  )
}

export default Example

| Prop name | Description | Type | Default | | ---------- | :-----------------------------------------------: | -----------: | ------------:| | usernane | Sets your Medium username | String | underfined | dataMedium | Set data Medium (only to Server Side Rendering) | Object | underfined | options | Object with options | Object | Object|

| Option | Description | Type | Default | | -------------| :------------------------------------------------: | -----------: | ------------:| | borderRadius | Set if the card will have rounded edges | Boolean | true | openInNewTab | Set if the link of article will openned in new tab | Boolean | true | showTags | Define if the card will show article tags | Boolean | false | showDate | Set if the card will show the date of the article | Boolean | false | ssr | Set if the component should rendered on server | Boolean | false|

List

import { List } from 'mediumpostscard'

function Example(){
  return (
    <List username="alex.streza" />
  )
}

export default Example

| Prop name | Description | Type | Default | | ---------- | :-----------------------------------------------: | -----------: | ------------:| | usernane | Sets your Medium username | String | underfined | dataMedium | Set data Medium (only to Server Side Rendering) | Object | underfined | options | Object with options | Object | Object|

| Option | Description | Type | Default | | -------------| :------------------------------------------------: | -----------: | ------------:| | openInNewTab | Set if the link of article will openned in new tab | Boolean | true | showTags | Define if the card will show article tags | Boolean | true | showDate | Set if the card will show the date of the article | Boolean | true | borderRadius | Set if the card will have rounded edges | Boolean | false | ssr | Set if the component should rendered on server | Boolean | false|

Label

import { Carousel, Label } from 'mediumpostscard'

function Example(){
  return (
    <Label>
      <Carousel username="alex.streza" />
    </Label>
  )
}

export default Example
import { List, Label } from 'mediumpostscard'

function Example(){
  return (
    <Label>
      <List username="alex.streza" />
    </Label>
  )
}

export default Example

| Prop name | Description | Type | Default | | ---------- |:----------------------------------:| ----------: | ----------------:| | text | Set text on label | String | 'Medium Articles' | children | Set component to be labeled | JSX.Element | No default

Server Side Rendering

To make the component render the server do the prefetching:

const dataMedium = fetchMedium('yourmediumusername')

Next define ssr as true, according to the example

<Carousel dataMedium={dataMedium} options={{ssr: true}} />

In the example above, I used the Carousel component, but you do the same with the List component.

Next I will show an example of how to make server side on Next.js

import Head from 'next/head'
import { List, fetchMedium } from 'mediumpostscard'

export default function Home({dataMedium}) {
  return (
    <div>
      <Head>
        <title>Create Next App</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>

      <List dataMedium={dataMedium} options={{ssr: true}} />

    </div>
  )
}

export async function getStaticProps() {
  const dataMedium = await fetchMedium('alex.streza')
  return {
    props: {
      dataMedium
    }
  }
}

How to contribute

Fork this repository, make clone for your machine.

Install the dependencies with the command below:

yarn install

To view on storybook

yarn storybook

To build

yarn build

To run the tests.

yarn test

More

Didn't you like any of the components? No problem! You can use Medium Posts API to build your own react component. Moreover you too can contribute with code. Feel free to add new features to our library. We are open-source.

✍️ Author