main
Last change
on this file since e958037 was e958037, checked in by Viktor <mlviktor23@…>, 2 years ago |
added styling to /professor/{professorId} page
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[e958037] | 1 | import { OpinionCard } from "./OpinionCard.style";
|
---|
| 2 |
|
---|
[3a44163] | 3 | function OpinionTree({ professor }) {
|
---|
[2998dc4] | 4 | var renderedOpinionIds = [];
|
---|
| 5 | var postCount; // za da ne go pokazuva ispod postot
|
---|
| 6 |
|
---|
| 7 | function displayChildPosts(child) {
|
---|
| 8 | if (child == null) return;
|
---|
| 9 | postCount = renderedOpinionIds.push(child.postId);
|
---|
[3a44163] | 10 | return (
|
---|
[2998dc4] | 11 | <div key={child.postId}>
|
---|
[e958037] | 12 | <p>
|
---|
| 13 | <a href="#">{child.author.username}</a> реплицирал
|
---|
| 14 | </p>
|
---|
[2998dc4] | 15 | <p>Содржина: {child.content}</p>
|
---|
| 16 | {child.children.map((childOfChild) => displayChildPosts(childOfChild))}
|
---|
[3a44163] | 17 | </div>
|
---|
| 18 | );
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | return (
|
---|
| 22 | <div className="opinionTree">
|
---|
| 23 | {professor.relatedOpinions.map((opinion) => {
|
---|
[2998dc4] | 24 | if (!renderedOpinionIds.includes(opinion.postId)) {
|
---|
| 25 | postCount = renderedOpinionIds.push(opinion.postId);
|
---|
[3a44163] | 26 | return (
|
---|
| 27 | <div key={opinion.postId}>
|
---|
[e958037] | 28 | <OpinionCard>
|
---|
| 29 | <p>
|
---|
| 30 | <a href="#">{opinion.author.username}</a> напишал
|
---|
| 31 | </p>
|
---|
| 32 |
|
---|
| 33 | <p>{opinion.title}</p>
|
---|
| 34 | <p>{opinion.content}</p>
|
---|
| 35 | <p>{Date(opinion.timePosted)}</p>
|
---|
| 36 | </OpinionCard>
|
---|
[3a44163] | 37 | {opinion.children.map((child) => displayChildPosts(child))}
|
---|
| 38 | </div>
|
---|
| 39 | );
|
---|
| 40 | }
|
---|
| 41 | })}
|
---|
| 42 | </div>
|
---|
| 43 | );
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | export default OpinionTree;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.