summaryrefslogtreecommitdiff
path: root/src/components/CommitteeList/CommitteeListItem.astro
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-10-13 21:43:18 +0100
committerGitHub <noreply@github.com>2023-10-13 21:43:18 +0100
commit429aef251345cf54af2feed3f8ecb608db7fd7e7 (patch)
tree37a73f2fa3be191ff3b493246dc9b1fc6b7c5f5c /src/components/CommitteeList/CommitteeListItem.astro
parent300f8c673829f6af26f1b5e73e4e9d10e8dd6692 (diff)
parenta37d5bd725cfe61c56d84f06a58d88872f6b7690 (diff)
Merge pull request #12 from Sycamost/optimise-images-again
Optimise images again
Diffstat (limited to 'src/components/CommitteeList/CommitteeListItem.astro')
-rw-r--r--src/components/CommitteeList/CommitteeListItem.astro55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/components/CommitteeList/CommitteeListItem.astro b/src/components/CommitteeList/CommitteeListItem.astro
new file mode 100644
index 0000000..9a5a55b
--- /dev/null
+++ b/src/components/CommitteeList/CommitteeListItem.astro
@@ -0,0 +1,55 @@
+---
+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"
+ srcset={`
+ ${committeeMember.img.width106.src} 106w,
+ ${committeeMember.img.width146.src} 146w,
+ ${committeeMember.img.width192.src} 192w,
+ ${committeeMember.img.width222.src} 222w
+ `}
+ sizes="
+ (min-width: 120rem) 222px,
+ (min-width: 96rem) 146px,
+ (min-width: 64rem) 192px,
+ (min-width: 48rem) 222px,
+ 106px
+ "
+ 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>