-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3112 from ONEARMY/feat/comment-list-with-nested-r…
…eplies feat(components): support nested comments
- Loading branch information
Showing
5 changed files
with
91 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { CommentWithReplies } from './CommentList' | ||
import { faker } from '@faker-js/faker' | ||
|
||
export const fakeComment = ( | ||
commentOverloads: Partial<CommentWithReplies> = {}, | ||
) => ({ | ||
_created: faker.date.past().toString(), | ||
creatorCountry: faker.address.countryCode().toLowerCase(), | ||
_creatorId: faker.internet.userName(), | ||
_id: faker.database.mongodbObjectId(), | ||
creatorName: faker.internet.userName(), | ||
isUserVerified: faker.datatype.boolean(), | ||
text: faker.lorem.text(), | ||
isEditable: faker.datatype.boolean(), | ||
...commentOverloads, | ||
}) | ||
|
||
export const createFakeComments = ( | ||
numberOfComments = 2, | ||
commentOverloads = {}, | ||
): CommentWithReplies[] => | ||
[...Array(numberOfComments).keys()].slice(0).map(() => | ||
fakeComment({ | ||
...commentOverloads, | ||
}), | ||
) |