Skip to content

Commit

Permalink
feat: change headers styles & add filter jozz
Browse files Browse the repository at this point in the history
  • Loading branch information
obeim committed Feb 1, 2024
1 parent 30abdfc commit b9eabe7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
20 changes: 16 additions & 4 deletions screens/home/components/JozzTab.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { FlatList } from "react-native";
import { FlatList, Text } from "react-native";
import { router } from "expo-router";
import JozzCard from "./JozzCard";
import { useQuery } from "react-query";
const JozzTab = () => {
import { useMemo } from "react";
const JozzTab = ({ search }: { search: string }) => {
const { data } = useQuery(
"jozzs",
async () => {
Expand All @@ -18,17 +19,28 @@ const JozzTab = () => {
{ cacheTime: Infinity }
);

const filterdData = useMemo(
() =>
data?.filter ? data?.filter((item) => item.name.includes(search)) : [],
[search, data]
);

return (
<FlatList
data={data}
data={filterdData}
scrollEnabled
className="h-[60%] flex-2 flex-col "
className="h-[60%] flex-2 flex-col mt-3"
numColumns={2}
contentContainerStyle={{ gap: 2 }}
columnWrapperStyle={{ gap: 10 }}
initialNumToRender={10}
showsVerticalScrollIndicator={false}
onEndReachedThreshold={0.5}
ListEmptyComponent={
<Text className="my-8 text-center text-gray-300 font-HelveticaLight">
لا يوجد
</Text>
}
renderItem={({ item }) => (
<JozzCard
onPress={() => {
Expand Down
7 changes: 5 additions & 2 deletions screens/home/components/TypeTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const TypeTabs = (props: { data: Surah[]; search: string }) => {
};
export const tabs = (props: { data: Surah[]; search: string }) => [
{ name: "surah", title: "سورة", component: <SurahTab {...props} /> },
{ name: "chapter", title: "جزء", component: <JozzTab /> },
{ name: "ayah", title: "أية" },
{
name: "chapter",
title: "جزء",
component: <JozzTab search={props.search} />,
},
{ name: "azkar", title: "الأذكار" },
];
7 changes: 3 additions & 4 deletions screens/jozz/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ export function Header({
subtitle?: string;
}) {
return (
<View className="flex flex-row justify-between py-4 px-2 h-[9%] bg-white items-center">
<View></View>
<View className="flex flex-row justify-between pb-4 pt-2 px-2 h-[7%] bg-white items-center">
<Pressable
onPress={() => {
router.back();
}}
className="bg-white flex-1 items-center"
className="bg-white items-center"
>
<Text className="font-HelveticaRoman text-lg text-primary">
{title}
Expand All @@ -30,7 +29,7 @@ export function Header({
}}
className=" h-10 items-center justify-end !w-10 flex-3 "
>
<BigArrow height={28} width={20} />
<BigArrow height={24} width={20} />
</Pressable>
</View>
);
Expand Down
4 changes: 2 additions & 2 deletions screens/jozz/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Jozz = () => {
renderItem={({ item, index }) => (
<View key={index}>
{item.sora_name_ar !== "no" && (
<Text className="my-2 rounded-full bg-primary mx-auto text-white font-UthmanicHafs text-lg w-1/2 text-center">
<Text className="my-2 bg-primary mx-auto text-white font-UthmanicHafs text-lg w-1/2 text-center">
{item.sora_name_ar}
</Text>
)}
Expand All @@ -38,7 +38,7 @@ const Jozz = () => {
/>
</View>
)}
className="w-full bg-lotion h-[91%] px-5 rounded-2xl overflow-hidden"
className="w-full bg-lotion h-[91%] px-5 overflow-hidden"
/>
</View>
)
Expand Down
9 changes: 4 additions & 5 deletions screens/surah/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ export function Header({
subtitle?: string;
}) {
return (
<View className="flex flex-row justify-between py-4 px-2 h-[9%] bg-white items-center">
<Menu width={24} height={32} />
<View className="flex flex-row justify-between pb-4 pt-2 px-2 h-[7%] bg-white items-center">
<Pressable
onPress={() => {
router.back();
}}
className="bg-white flex-1 items-center"
className="bg-white flex-3 items-center"
>
<Text className="font-HelveticaRoman text-lg text-primary">
<Text className="font-HelveticaRoman text-lg text-primary text-center">
{title}
</Text>
<Text className="font-HelveticaRoman text-primary/30 text-xs">
Expand All @@ -34,7 +33,7 @@ export function Header({
}}
className=" h-10 items-center justify-end !w-10 flex-3 "
>
<BigArrow height={28} width={20} />
<BigArrow height={24} width={20} />
</Pressable>
</View>
);
Expand Down
2 changes: 1 addition & 1 deletion screens/surah/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Surah = () => {
/>
</>
)}
className="w-full bg-lotion h-[91%] px-5 rounded-2xl overflow-hidden"
className="w-full bg-lotion h-[93%] px-5 overflow-hidden"
/>
</View>
</View>
Expand Down

0 comments on commit b9eabe7

Please sign in to comment.