2024-10-30 23:02:42 +00:00
|
|
|
/**
|
|
|
|
* @copyright nhcarrigan
|
|
|
|
* @license Naomi's Public License
|
|
|
|
* @author Naomi Carrigan
|
|
|
|
*/
|
2024-08-25 02:40:46 +00:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { Rule } from "./rule";
|
2024-10-30 23:02:42 +00:00
|
|
|
import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
|
|
import type { JSX } from "react";
|
2024-08-25 02:40:46 +00:00
|
|
|
|
2024-10-30 23:02:42 +00:00
|
|
|
interface ReviewProperties {
|
|
|
|
readonly name: string;
|
|
|
|
readonly date: Date;
|
|
|
|
readonly content: string;
|
|
|
|
readonly sourceIcon: IconDefinition;
|
|
|
|
readonly sourceUrl: string;
|
|
|
|
readonly sourceName: string;
|
2024-08-25 02:40:46 +00:00
|
|
|
}
|
|
|
|
|
2024-10-30 23:02:42 +00:00
|
|
|
/**
|
|
|
|
* Renders the view for a review.
|
|
|
|
* @param properties - The review to render.
|
|
|
|
* @returns A JSX element.
|
|
|
|
*/
|
|
|
|
export const Review = (properties: ReviewProperties): JSX.Element => {
|
|
|
|
const { name, date, content, sourceIcon, sourceUrl, sourceName } = properties;
|
2024-08-25 02:40:46 +00:00
|
|
|
return (
|
|
|
|
<li className="mb-10 ms-6">
|
2024-10-30 23:02:42 +00:00
|
|
|
<span className="absolute flex items-center justify-center
|
|
|
|
w-6 h-6 bg-[--background] text-[--foreground] rounded-full -start-3">
|
2024-08-25 02:40:46 +00:00
|
|
|
<FontAwesomeIcon icon={sourceIcon} />
|
|
|
|
</span>
|
2024-10-30 23:02:42 +00:00
|
|
|
<div className="items-center justify-between p-4 bg-white
|
|
|
|
border border-gray-200 rounded-lg shadow-sm sm:flex
|
|
|
|
dark:bg-gray-700 dark:border-gray-600">
|
|
|
|
<time className="mb-1 text-xs font-normal
|
|
|
|
text-gray-400 sm:order-last sm:mb-0">
|
2024-08-25 02:40:46 +00:00
|
|
|
{date.toLocaleDateString("en-GB")}
|
|
|
|
</time>
|
|
|
|
<div className="text-md font-normal text-gray-500 dark:text-gray-300">
|
2024-10-30 23:02:42 +00:00
|
|
|
{`Review from `}
|
2024-08-25 02:40:46 +00:00
|
|
|
<a
|
2024-10-30 23:02:42 +00:00
|
|
|
className="font-semibold text-[#abfcec] hover:underline"
|
2024-08-25 02:40:46 +00:00
|
|
|
href={sourceUrl}
|
|
|
|
rel="noopener noreferrer"
|
2024-10-30 23:02:42 +00:00
|
|
|
target="_blank"
|
2024-08-25 02:40:46 +00:00
|
|
|
>
|
|
|
|
{name}
|
2024-10-30 23:02:42 +00:00
|
|
|
</a>{` via `}
|
|
|
|
<span className="bg-gray-100 text-gray-800 text-xs font-normal
|
|
|
|
me-2 px-2.5 py-0.5 rounded dark:bg-gray-600 dark:text-gray-300">
|
2024-08-25 02:40:46 +00:00
|
|
|
{sourceName}
|
|
|
|
</span>
|
|
|
|
<Rule />
|
|
|
|
<p className="text-sm">{content}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
};
|