From 407a965ba0da445ca807d5febdbe231ea0150fdc Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 6 Feb 2023 01:20:33 +0000 Subject: [PATCH] code edits --- beta/src/components/Layout/HomeContent.js | 62 ++++++++++------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/beta/src/components/Layout/HomeContent.js b/beta/src/components/Layout/HomeContent.js index db0e58bc7..c207efbad 100644 --- a/beta/src/components/Layout/HomeContent.js +++ b/beta/src/components/Layout/HomeContent.js @@ -345,23 +345,21 @@ function Example1() {

- Comment.js + Album.js

-
{`function Comment({ comment }) { +
{`function Album({ album }) { return ( - - - - {author.name} - - - - +
+ +

{album.title}

+

{album.year}

+ +
); } `}
@@ -434,23 +432,23 @@ function Example2() {

- CommentList.js + AlbumList.js

-
{`function CommentList({ comments }) { - let heading = 'Be the first to comment'; - if (comments.length > 0) { - heading = comments.length + ' Comments'; +
{`function AlbumList({ albums }) { + let heading = 'No releases yet'; + if (albums.length > 0) { + heading = albums.length + ' Albums'; } return (

{heading}

- {comments.map(comment => - + {albums.map(album => + )}
); @@ -567,32 +565,28 @@ function Example3() {

- PostPage.js + ArtistPage.js

-
{`async function PostPage({ slug }) { - const post = await db.findPost({ slug }); +
{`async function ArtistPage({ slug }) { + const artist = await db.findArtist({ slug }); return ( - - }> - + +

{artist.name}

+ }> + -
+ ); } -async function PostComments({ postId }) { - const comments = await db.findComments({ postId }); - return ( - <> - - - - ); +async function Discography({ artistId }) { + const albums = await db.findAlbums({ artistId }); + return ; }`}
@@ -748,9 +742,9 @@ function PostComments({post, commentsPromise}) { } function CommentList({comments, children}) { - let headingText = 'Be the first to comment'; + let headingText = 'No releases yet'; if (comments.length > 0) { - headingText = comments.length + ' Comments'; + headingText = comments.length + ' Albums'; } return (