add props and link to home section

This commit is contained in:
2025-06-01 08:57:49 +02:00
parent 017b04116d
commit 3af1e72c06
4 changed files with 36 additions and 8 deletions

View File

@@ -1,10 +1,9 @@
import { View} from 'react-native';
import { View, FlatList} from 'react-native';
import { useEffect, useState } from 'react'
import { Heading } from '@/components/ui/heading';
import { Text } from '@/components/ui/text';
// import { useNoticesStore } from '@/store/noticesStore';
import { Link } from 'expo-router';
import { Pressable } from '@/components/ui/pressable';
import { FlatList } from 'react-native';
import axios from 'axios';
export function CategorySection({notices, title}) {
@@ -38,11 +37,13 @@ return (
renderItem={({ item }) => {
const categoryObj = categoryMap.find((cat) => cat.value === item);
return (
<Link href={`/notices?category=${item}`} asChild>
<Pressable className="bg-gray-200 p-4 rounded-lg mr-2">
<Text>
{categoryObj ? categoryObj.label : item} ({getCount(item)})
</Text>
</Pressable>
</Link>
);
}}
/>

View File

@@ -1,5 +1,6 @@
import { View} from 'react-native';
import { Heading } from '@/components/ui/heading';
import { Link } from 'expo-router';
import { FlatList } from 'react-native';
import {NoticeCard} from "@/components/NoticeCard";
import { Box } from '@/components/ui/box';
@@ -7,7 +8,7 @@ import { HStack } from "@/components/ui/hstack"
import { VStack } from '@/components/ui/vstack';
import { Button, ButtonText } from "@/components/ui/button"
export function NoticeSection({ notices, title }) {
export function NoticeSection({ notices, title, ctaLink=''}) {
const rows = [];
for (let i = 0; i < notices.length; i += 2) {
rows.push(
@@ -23,9 +24,12 @@ export function NoticeSection({ notices, title }) {
<VStack space="md">
{rows}
</VStack>
{ctaLink && (
<Link href={ctaLink} asChild>
<Button className="mt-6" size="md" variant="solid" action="primary">
<ButtonText>Zobacz więcej</ButtonText>
</Button>
</Link>)}
</View>
);
}