diff options
| author | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-10-13 21:26:13 +0100 |
|---|---|---|
| committer | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-10-13 21:26:13 +0100 |
| commit | 796fdeed465f8a4f9d4aaaaf9ddf448f91e901e6 (patch) | |
| tree | 689207e496fc25b7cb1d33004194bb9f9a14d102 /src/components | |
| parent | 8b2d91cb1cdff722bb4913c8f023c6cd16801e5c (diff) | |
Pulls out CommitteeList component
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/CommitteeList/CommitteeList.astro | 8 | ||||
| -rw-r--r-- | src/components/CommitteeList/CommitteeListItem.astro | 39 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/components/CommitteeList/CommitteeList.astro b/src/components/CommitteeList/CommitteeList.astro new file mode 100644 index 0000000..f576c9a --- /dev/null +++ b/src/components/CommitteeList/CommitteeList.astro @@ -0,0 +1,8 @@ +--- +import committee from '$data/committee'; +import CommitteeListItem from './CommitteeListItem.astro'; +--- + +<ul> + {committee.map((committeeMember) => <CommitteeListItem committeeMember={committeeMember} />)} +</ul> diff --git a/src/components/CommitteeList/CommitteeListItem.astro b/src/components/CommitteeList/CommitteeListItem.astro new file mode 100644 index 0000000..d026047 --- /dev/null +++ b/src/components/CommitteeList/CommitteeListItem.astro @@ -0,0 +1,39 @@ +--- +import CommitteeRole from '$enums/CommitteeRole'; +import tRole from '$i18n/translations/enums/committeeRole'; +import translate from '$i18n/translate'; +import type { CommitteeMember } from '$types/CommitteeMember'; +import type Locale from '$types/Locale'; + +interface Props { + committeeMember: CommitteeMember; +} + +const { committeeMember } = Astro.props; + +const locale = Astro.params.locale as Locale; + +const t = translate(locale); +--- + +<li class="committee__member"> + { + committeeMember.img && ( + <img class="committee__member__img" src={committeeMember.img.src} alt="" /> + ) + } + <div class="committee__member__text"> + <h4> + {committeeMember.name} + { + committeeMember.roles.length > 0 && ( + <span class="font-weight-lighter"> + |{' '} + {committeeMember.roles.map((role) => t(tRole, { key: CommitteeRole[role] })).join(', ')} + </span> + ) + } + </h4> + {committeeMember.bio && <p set:html={committeeMember.bio[locale]} />} + </div> +</li> |
