Cleanup of review-css to use tailwind

This commit is contained in:
Pieter Vander Vennet 2021-03-13 19:07:38 +01:00
parent 9cb3a49b28
commit a76d8822ff
7 changed files with 52 additions and 108 deletions

View file

@ -22,9 +22,9 @@ export default class SingleReview extends UIElement{
}
const scoreTen = Math.round(rating / 10);
return new Combine([
"<img src='./assets/svg/star.svg' />".repeat(Math.floor(scoreTen / 2)),
scoreTen % 2 == 1 ? "<img src='./assets/svg/star_half.svg' />" : ""
])
"<img src='./assets/svg/star.svg' class='h-8 md:h-12'/>".repeat(Math.floor(scoreTen / 2)),
scoreTen % 2 == 1 ? "<img src='./assets/svg/star_half.svg' class='h-8 md:h-12'/>" : ""
]).SetClass("flex w-max")
}
InnerRender(): string {
const d = this._review.date;
@ -32,26 +32,24 @@ export default class SingleReview extends UIElement{
const el= new Combine(
[
new Combine([
SingleReview.GenStars(review.rating)
.SetClass("review-rating"),
new FixedUiElement(review.comment).SetClass("review-comment")
]).SetClass("review-stars-comment"),
SingleReview.GenStars(review.rating)
]),
new FixedUiElement(review.comment),
new Combine([
new Combine([
new FixedUiElement(review.author).SetClass("review-author"),
new Combine(["<b>",review.author,"</b>"]),
review.affiliated ? Translations.t.reviews.affiliated_reviewer_warning : "",
]).SetStyle("margin-right: 0.5em"),
new FixedUiElement(`${d.getFullYear()}-${Utils.TwoDigits(d.getMonth() + 1)}-${Utils.TwoDigits(d.getDate())} ${Utils.TwoDigits(d.getHours())}:${Utils.TwoDigits(d.getMinutes())}`)
.SetClass("review-date")
]).SetClass("review-author-date")
.SetClass("subtle-lighter")
]).SetClass("flex mb-4 justify-end")
]
);
el.SetClass("review-element");
if(review.made_by_user){
el.SetClass("review-by-current-user")
el.SetClass("block p-2 m-1 rounded-xl subtle-background review-element");
if(review.made_by_user.data){
el.SetClass("border-attention-catch")
}
return el.Render();
}