Skip to content

Commit

Permalink
feat: add solat jumaat & qiblat certified label
Browse files Browse the repository at this point in the history
  • Loading branch information
atmahana committed Aug 20, 2023
1 parent 4b5efd2 commit 5fe7da8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
15 changes: 12 additions & 3 deletions src/components/SurauList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import Image from "next/image";
import { useRouter } from "next/router";
import { api } from "../utils/api";
import Badge from "./shared/Badge";

const SurauList = ({
type,
Expand Down Expand Up @@ -118,9 +119,17 @@ const SurauList = ({
)}
</div>
{/* <h3 className="mt-4 text-sm text-gray-700">{surau.location}</h3> */}
<p className="mt-1 truncate text-start text-lg font-medium text-gray-900">
{surau.name}
</p>
<div className="mt-1 flex justify-between">
<p className="truncate text-start text-lg font-medium text-gray-900">
{surau.name}
</p>
</div>
<div className="mt-1 flex flex-wrap gap-1">
{surau?.is_solat_jumaat && <Badge text="Solat Jumaat" />}
{surau?.is_qiblat_certified && (
<Badge text="Qiblat Certified" />
)}
</div>
</a>
))
)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/SurauReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import SurauOverview from "./SurauOverview";
import Header from "./shared/Header";
import Modal from "./shared/Modal";
import SignIn from "./shared/SignIn";
import Badge from "./shared/Badge";

function classNames(...classes: string[]) {
return classes.filter(Boolean).join(" ");
Expand Down Expand Up @@ -165,10 +166,9 @@ const SurauReview = () => {

<div className="mt-2 flex flex-row space-x-2">
{surau.data?.is_solat_jumaat && (
<h3 className="font-base inline-flex items-center rounded-full bg-green-100 px-3 py-1.5 text-sm text-green-800">
Solat Jumaat
</h3>
<Badge text="Solat Jumaat" />
)}
{surau.data?.is_qiblat_certified && <Badge text="Qiblat Certified" />}
</div>
<div className="mt-2">
<h3 className="text-lg font-medium text-gray-900">Direction</h3>
Expand Down
15 changes: 15 additions & 0 deletions src/components/shared/Badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { FC } from "react";

interface BadgeProps {
text: string;
}

const Badge: FC<BadgeProps> = ({ text }) => {
return (
<h3 className="font-base inline-flex items-center rounded-full bg-green-100 px-3 py-1.5 text-sm text-green-800">
{text}
</h3>
);
};

export default Badge;
7 changes: 7 additions & 0 deletions src/pages/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import StateSelect from "../components/shared/StateSelect";
import useSurauStore from "../store/surau";
import { truncateName } from "../utils";
import { api } from "../utils/api";
import Badge from "../components/shared/Badge";

const surauUnorderedListVariants = {
open: {
Expand Down Expand Up @@ -122,6 +123,12 @@ const SurauList = () => {
<p className="text-xs font-light">
{surau.district.name}, {surau.state.name}
</p>
<div className="mt-2 flex flex-wrap gap-1">
{surau?.is_solat_jumaat && <Badge text="Solat Jumaat" />}
{surau?.is_qiblat_certified && (
<Badge text="Qiblat Certified" />
)}
</div>
</div>
<div className="max-h-12 overflow-hidden rounded-xl bg-gray-200 object-fill">
{surau.images[0]?.file_path ? (
Expand Down

0 comments on commit 5fe7da8

Please sign in to comment.