mirror of
https://github.com/koodiklinikka/koodiklinikka.fi.git
synced 2026-03-18 04:05:09 +00:00
Chore/convert to typescript (#60)
* Convert to using TypeScript Next.js v.9 allows converting an existing project to TS by simply renaming the files as TS files * Fix type errors: Type 'string' is not assignable to type 'number'. * Add mention about missing typings for javascript-time-ago * Add GA_INITIALIZED to window * Fix type error in feed transformers * Model MembershipInfoForm state and props with TS * Silence the typescript warning in MembershipInfoForm * Add threshold to Fader props * Fix Warning: Each child in a list should have a unique "key" prop. Sponsors don't have ids – name is probably unique and can be used as a key * Allow key as prop for SponsorLink * Add type of the props for SponsorLink
This commit is contained in:
committed by
Riku Rouvila
parent
bcc6619aee
commit
f4474523ad
43
components/Members.tsx
Normal file
43
components/Members.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import React from "react";
|
||||
import request from "axios";
|
||||
import shuffle from "lodash/shuffle";
|
||||
import api from "./api";
|
||||
|
||||
export default class Members extends React.Component {
|
||||
state = {
|
||||
members: [],
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.refreshMembers();
|
||||
}
|
||||
|
||||
async refreshMembers() {
|
||||
const res = await request.get(api("members"));
|
||||
this.setState({
|
||||
members: shuffle(res.data),
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const members = this.state.members.map(member => {
|
||||
const src = `${member.avatar_url}&s=120`;
|
||||
return (
|
||||
<img className="member" key={member.avatar_url} src={src} alt="" />
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="members" aria-hidden="true">
|
||||
<a
|
||||
href="https://github.com/koodiklinikka"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
tabIndex={-1}
|
||||
>
|
||||
{members}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user