Skip to content

Commit d955af2

Browse files
committed
refactor: isProfessor
1 parent 56b32b0 commit d955af2

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/components/PersonCard.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { CollectionEntry } from 'astro:content';
33
import { Icon } from 'astro-icon';
44
import { getProjectsByPerson } from '../helpers/projects';
5-
import { getPersonTags } from '../helpers/people';
5+
import { getPersonTags, isProfessor } from '../helpers/people';
66
import {
77
getCourseAbbreviationByOccupation,
88
getCourseAbbreviationCampusByOccupation,
@@ -110,9 +110,7 @@ const tags = await getPersonTags(person);
110110
))
111111
}
112112
{
113-
person.data.occupations.some(
114-
(occupation) => occupation.type === 'professor'
115-
) && (
113+
isProfessor(person) && (
116114
<span class="text-[10px] pointer text-[10px] inline-block font-semibold text-gray-700 bg-gray-100 hover:bg-gray-200 m-0.5 py-px px-0.5 rounded-full">
117115
professor
118116
</span>

src/helpers/people.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { getCollection } from 'astro:content';
22
import { getProjectsByPerson } from './projects';
33

4-
function isStudent(person) {
4+
export function isStudent(person) {
55
return person.data.occupations.some(
66
(occupation) => occupation.type === 'student'
77
);
88
}
99

10-
function isProfessor(person) {
10+
export function isProfessor(person) {
1111
return person.data.occupations.some(
1212
(occupation) => occupation.type === 'professor'
1313
);

0 commit comments

Comments
 (0)