Skip to content

Instantly share code, notes, and snippets.

@indreklasn
Created November 10, 2020 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indreklasn/28d19db85a6b31cdb24b9b073cd28011 to your computer and use it in GitHub Desktop.
Save indreklasn/28d19db85a6b31cdb24b9b073cd28011 to your computer and use it in GitHub Desktop.
import React from "react";
import Skeleton from "react-loading-skeleton";
const imgUrl =
"https://cdn-images-1.medium.com/fit/c/50/50/1*Rhzd_aZYgwP2gocFecKi0Q.png";
export default function BlogPost({ title, body, subTitle }) {
return (
<div>
{body ? (
<img src={imgUrl} width="50px" height="50px" alt="profile" />
) : (
<Skeleton circle={true} height={50} width={50} />
)}
<h1>{title || <Skeleton />}</h1>
<h3>{subTitle || <Skeleton />}</h3>
<p>{body || <Skeleton count={6} />}</p>
<button>
{body ? "Read more" : <Skeleton height={25} width={100} />}
</button>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment