-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: announcements added to the Home screen (#140)
* feat: frontend refont with annoucements added on Home screen * feat: announcement first try * feat: announcement first try * fix: handle events onPress * test: added all tests * fix: duplicate lines * fix: delete duplicate * fix: final * fix: resolved sonarCloud issues with imports
- Loading branch information
1 parent
f4f99c9
commit c246a18
Showing
20 changed files
with
537 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react-native' | ||
import AnnouncementScreen from '../../../screens/Home/AnnouncementScreen/AnnouncementScreen' | ||
import AnnouncementCard from '../../../components/AnnoucementCard/AnnouncementCard' | ||
|
||
// Import your AnnouncementScreen component | ||
|
||
// Mock any external components not relevant for the test | ||
jest.mock('react-native-gesture-handler', () => ({ | ||
// eslint-disable-next-line react/prop-types | ||
TouchableOpacity: ({ children, onPress }) => <div onClick={onPress}>{children}</div> | ||
})) | ||
jest.mock("@expo/vector-icons", () => ({ | ||
Ionicons: () => "Ionicon" | ||
})) | ||
jest.mock('../../../components/AnnoucementCard/AnnouncementCard', () => 'AnnouncementCard') | ||
describe('AnnouncementScreen', () => { | ||
|
||
it('renders correctly', async () => { | ||
const { getByText, debug } = render( | ||
|
||
<AnnouncementScreen /> | ||
|
||
) | ||
debug() | ||
// Verify that the screen renders future announcements | ||
expect(getByText('Future Announcements')).toBeTruthy() | ||
}), | ||
it('rendre card correclty', async () => { | ||
const announcement = { | ||
uid: '1', | ||
title: 'Spring Festival', | ||
location: 'Community Park', | ||
description: 'Annual community gathering', | ||
date: '2023-05-10', | ||
interests: ['Music', 'Food', 'Games'] | ||
} | ||
|
||
const component = render(<AnnouncementCard {...announcement} />) | ||
expect(component).toBeTruthy() | ||
} | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
import { styles } from "./styles" | ||
import React,{ View, Text } from "react-native" | ||
import { Announcement } from "../../types/Annoucements" | ||
|
||
|
||
const AnnouncementCard = (announcement: Announcement) => { | ||
return ( | ||
<View style={styles.cardContainer}> | ||
<Text style={styles.title}> | ||
{announcement.title} | ||
</Text> | ||
<Text style={styles.category}> | ||
{announcement.interests.join("- ")} | ||
</Text> | ||
</View> | ||
) | ||
} | ||
|
||
export default AnnouncementCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { StyleSheet } from 'react-native' | ||
import { lightGray, lightPeach, peach, shadowColor} from '../../assets/colors/colors' | ||
|
||
export const styles = StyleSheet.create({ | ||
cardContainer: { | ||
backgroundColor: lightPeach, | ||
borderColor: peach, | ||
borderRadius: 10, | ||
borderWidth: 1, | ||
margin: 10, | ||
padding: 20, | ||
shadowColor: shadowColor, | ||
shadowOffset: { | ||
height: 2, | ||
width: 0, | ||
}, | ||
shadowOpacity: 0.25, | ||
shadowRadius: 3.84, | ||
}, | ||
category: { | ||
color: lightGray, | ||
fontSize: 14, | ||
fontStyle: "italic", | ||
|
||
}, | ||
title: { | ||
fontSize: 18, | ||
fontWeight: 'bold', | ||
marginBottom: 5, | ||
}, | ||
|
||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.