Skip to content

Commit

Permalink
more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
in-mai-space committed May 28, 2024
1 parent d6c63d1 commit 79815c3
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 21,310 deletions.
3 changes: 2 additions & 1 deletion frontend/mobile/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = {
plugins: ['prettier', 'jest'],
rules: {
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off'
'react/react-in-jsx-scope': 'off',
'react-native/no-inline-styles': 'off',
},
env: {
'jest/globals': true
Expand Down
61 changes: 41 additions & 20 deletions frontend/mobile/app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';

import { Tabs } from 'expo-router';
import { Text } from '@/app/(design-system)';
import { Box, Colors } from '@/app/(design-system)';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { faHouse } from '@fortawesome/free-solid-svg-icons/faHouse';

import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import { faCalendarDays } from '@fortawesome/free-solid-svg-icons/faCalendarDays';
import { faHouse } from '@fortawesome/free-solid-svg-icons/faHouse';
import { faUser } from '@fortawesome/free-solid-svg-icons/faUser';
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';

import { Text } from '@/app/(design-system)';
import { Box, Colors } from '@/app/(design-system)';

interface TabBarLabelProps {
focused: boolean;
Expand All @@ -26,45 +29,63 @@ interface TabBarIconProps {

const TabBarIcon: React.FC<TabBarIconProps> = ({ focused, icon }) => (
<Box paddingTop="m">
<FontAwesomeIcon size={20} color={focused? 'black' : `${Colors.gray}`} icon={icon} />
<FontAwesomeIcon
size={20}
color={focused ? 'black' : `${Colors.gray}`}
icon={icon}
/>
</Box>
);

const Layout = () => {
return (
<Tabs screenOptions={{
tabBarShowLabel: true,
tabBarStyle: {
borderTopWidth: 1,
borderTopColor: '#00000066',
height: 85,
},
}}>
<Tabs
screenOptions={{
tabBarShowLabel: true,
tabBarStyle: {
borderTopWidth: 1,
borderTopColor: '#00000066',
height: 85
}
}}
>
<Tabs.Screen
name="index"
options={{
title: 'Home',
headerShown: false,
tabBarLabel: ({ focused }) => <TabBarLabel focused={focused} title="Home" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} icon={faHouse} />,
tabBarLabel: ({ focused }) => (

Check warning on line 57 in frontend/mobile/app/(app)/(tabs)/_layout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Layout” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<TabBarLabel focused={focused} title="Home" />
),
tabBarIcon: ({ focused }) => (

Check warning on line 60 in frontend/mobile/app/(app)/(tabs)/_layout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Layout” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<TabBarIcon focused={focused} icon={faHouse} />
)
}}
/>
<Tabs.Screen
name="calendar"
options={{
title: 'Calendar',
headerShown: false,
tabBarLabel: ({ focused }) => <TabBarLabel focused={focused} title="Calendar" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} icon={faCalendarDays} />,
tabBarLabel: ({ focused }) => (

Check warning on line 70 in frontend/mobile/app/(app)/(tabs)/_layout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Layout” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<TabBarLabel focused={focused} title="Calendar" />
),
tabBarIcon: ({ focused }) => (

Check warning on line 73 in frontend/mobile/app/(app)/(tabs)/_layout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Layout” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<TabBarIcon focused={focused} icon={faCalendarDays} />
)
}}
/>
<Tabs.Screen
name="profile"
options={{
title: 'Profile',
headerShown: false,
tabBarLabel: ({ focused }) => <TabBarLabel focused={focused} title="Profile" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} icon={faUser} />,
tabBarLabel: ({ focused }) => (

Check warning on line 83 in frontend/mobile/app/(app)/(tabs)/_layout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Layout” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<TabBarLabel focused={focused} title="Profile" />
),
tabBarIcon: ({ focused }) => (

Check warning on line 86 in frontend/mobile/app/(app)/(tabs)/_layout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Layout” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<TabBarIcon focused={focused} icon={faUser} />
)
}}
/>
</Tabs>
Expand Down
93 changes: 48 additions & 45 deletions frontend/mobile/components/club-recruitment-info.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,59 @@
import React from 'react';
import { RecruitmentCycle, RecruitmentType } from '@generatesac/lib';
import { Box, ColorName } from '@/app/(design-system)';

import { faCalendar } from '@fortawesome/free-regular-svg-icons/faCalendar';
import { faPenToSquare } from '@fortawesome/free-solid-svg-icons/faPenToSquare';
import { faComments } from '@fortawesome/free-solid-svg-icons/faComments';
import { faPenToSquare } from '@fortawesome/free-solid-svg-icons/faPenToSquare';
import { RecruitmentCycle, RecruitmentType } from '@generatesac/lib';

import { Box, ColorName } from '@/app/(design-system)';

import { RecruitmentItem } from './club-recruitment-item';

interface RecruitmentInfoProps {
color: ColorName;
recruitmentCycle: RecruitmentCycle;
recruitingType: RecruitmentType;
isRecruiting?: boolean;
recruitmentText: string;
color: ColorName;
recruitmentCycle: RecruitmentCycle;
recruitingType: RecruitmentType;
isRecruiting?: boolean;
recruitmentText: string;
}

export const RecruitmentInfo = ({
recruitmentText,
color,
recruitmentCycle,
recruitingType,
isRecruiting = false,
recruitmentText,
color,
recruitmentCycle,
recruitingType,
isRecruiting = false
}: RecruitmentInfoProps) => {
return (
<Box
padding="l"
flexDirection="row"
gap="m"
alignItems="stretch"
justifyContent="space-evenly"
>
<RecruitmentItem
icon={faCalendar}
title="Recruitment Cycle"
text={recruitmentCycle}
color={color}
/>
<RecruitmentItem
icon={faPenToSquare}
title={
isRecruiting
? 'Currently Recruiting'
: 'Currently Not Recruiting'
}
text={recruitmentText}
color={color}
/>
<RecruitmentItem
icon={faComments}
title="Application Type"
text={recruitingType}
color={color}
/>
</Box>
);
return (
<Box
padding="l"
flexDirection="row"
gap="m"
alignItems="stretch"
justifyContent="space-evenly"
>
<RecruitmentItem
icon={faCalendar}
title="Recruitment Cycle"
text={recruitmentCycle}
color={color}
/>
<RecruitmentItem
icon={faPenToSquare}
title={
isRecruiting
? 'Currently Recruiting'
: 'Currently Not Recruiting'
}
text={recruitmentText}
color={color}
/>
<RecruitmentItem
icon={faComments}
title="Application Type"
text={recruitingType}
color={color}
/>
</Box>
);
};
37 changes: 21 additions & 16 deletions frontend/mobile/components/club-recruitment-item.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { Box, ColorName, Colors, Text } from "@/app/(design-system)";
import { firstLetterUppercase } from "@/utils/string";
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';

import { Box, ColorName, Colors, Text } from '@/app/(design-system)';
import { firstLetterUppercase } from '@/utils/string';

interface RecruitmentItemProps {
icon: IconDefinition;
title: string;
text: string;
color: ColorName;
}

export const RecruitmentItem = ({ icon, title, text, color }: RecruitmentItemProps) => {

export const RecruitmentItem = ({
icon,
title,
text,
color
}: RecruitmentItemProps) => {
return (
<Box
alignItems="center"
Expand All @@ -20,18 +26,18 @@ export const RecruitmentItem = ({ icon, title, text, color }: RecruitmentItemPro
width={'30%'}
>
<Box
paddingTop="l"
paddingBottom="l"
gap="xs"
flexDirection="column"
alignItems="center"
paddingTop="l"
paddingBottom="l"
gap="xs"
flexDirection="column"
alignItems="center"
>
<FontAwesomeIcon size={30} color={Colors[color]} icon={icon} />
<Text
style={{
textAlign: 'center',
fontWeight: '600',
fontSize: 14,
textAlign: 'center',
fontWeight: '600',
fontSize: 14
}}
>
{firstLetterUppercase(title)}
Expand All @@ -42,5 +48,4 @@ export const RecruitmentItem = ({ icon, title, text, color }: RecruitmentItemPro
</Box>
</Box>
);
};

};
Loading

0 comments on commit 79815c3

Please sign in to comment.