Skip to content

Commit

Permalink
remove maxItems handling, showing all tweets when user presses on twe…
Browse files Browse the repository at this point in the history
…ets button
  • Loading branch information
karpathy committed Apr 4, 2020
1 parent 11e4c61 commit 921f8c4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions static/paper_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@ const Tweet = props => {

const Tweets = props => {
const [collapsed, setCollapsed] = React.useState(true);
const maxItems = 10;
const tweetsList = props.tweets.slice(0, maxItems + 1); //Ignore excess tweets
return (
//Make sure there are tweets.
tweetsList.length > 0 && (
props.tweets.length > 0 && (
collapsed ? (
//Show just the summary statistics.
<div class='rel_tweets_summary' onClick={() => setCollapsed(false)}>
{tweetsList.length + " tweets"}
{props.tweets.length + " tweets"}
</div>
) : (
//Show tweets in expanded view.
<div class='rel_tweets'>
{tweetsList.map((jtweet, ix) => <Tweet key={ix} tweet={jtweet} />)}
{props.tweets.map((jtweet, ix) => <Tweet key={ix} tweet={jtweet} />)}
</div>
)
)
Expand Down

0 comments on commit 921f8c4

Please sign in to comment.