Skip to content

Commit

Permalink
Add deleted and invalid tweet-id cases
Browse files Browse the repository at this point in the history
  • Loading branch information
caroqliu committed May 7, 2021
1 parent 648bd73 commit f5a5683
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
50 changes: 50 additions & 0 deletions extensions/amp-twitter/0.1/storybook/Basic.amp.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,53 @@ export const timelines = () => {
/>
);
};

export const deletedTweet = () => {
const withFallback = boolean('include fallback?', true);
return (
<amp-twitter
width="390"
height="330"
layout="fixed"
data-tweetid="882818033403789316"
data-cards="hidden"
>
<blockquote placeholder>
<p lang="en" dir="ltr">
In case you missed it last week, check out our recap of AMP in 2020
⚡🙌
</p>
<p>
Watch here ➡️
<br />
<a href="https://t.co/eaxT3MuSAK">https://t.co/eaxT3MuSAK</a>
</p>
</blockquote>
{withFallback && (
<div fallback>
An error occurred while retrieving the tweet. It might have been
deleted.
</div>
)}
</amp-twitter>
);
};

export const invalidTweet = () => {
return (
<amp-twitter
width="390"
height="330"
layout="fixed"
data-tweetid="1111111111111641653602164060160"
data-cards="hidden"
>
<blockquote placeholder class="twitter-tweet" data-lang="en">
<p>
This placeholder should never change because given tweet-id is
invalid.
</p>
</blockquote>
</amp-twitter>
);
};
50 changes: 50 additions & 0 deletions extensions/amp-twitter/1.0/storybook/Basic.amp.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,53 @@ export const timelines = () => {
/>
);
};

export const deletedTweet = () => {
const withFallback = boolean('include fallback?', true);
return (
<amp-twitter
width="390"
height="330"
layout="fixed"
data-tweetid="882818033403789316"
data-cards="hidden"
>
<blockquote placeholder>
<p lang="en" dir="ltr">
In case you missed it last week, check out our recap of AMP in 2020
⚡🙌
</p>
<p>
Watch here ➡️
<br />
<a href="https://t.co/eaxT3MuSAK">https://t.co/eaxT3MuSAK</a>
</p>
</blockquote>
{withFallback && (
<div fallback>
An error occurred while retrieving the tweet. It might have been
deleted.
</div>
)}
</amp-twitter>
);
};

export const invalidTweet = () => {
return (
<amp-twitter
width="390"
height="330"
layout="fixed"
data-tweetid="1111111111111641653602164060160"
data-cards="hidden"
>
<blockquote placeholder class="twitter-tweet" data-lang="en">
<p>
This placeholder should never change because given tweet-id is
invalid.
</p>
</blockquote>
</amp-twitter>
);
};

0 comments on commit f5a5683

Please sign in to comment.