aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/account.tsx29
1 files changed, 20 insertions, 9 deletions
diff --git a/components/account.tsx b/components/account.tsx
index e6ec58f..3ebfbca 100644
--- a/components/account.tsx
+++ b/components/account.tsx
@@ -1,16 +1,27 @@
+import { Component } from "react";
+
interface AccountAvatarProps {
size: number;
- image: string;
+ image?: string;
+ dummy?: boolean;
+ fallbackFill?: string;
+ round?: boolean;
}
-export function AccountAvatar(props: AccountAvatarProps) {
- return <div style={{
- width: props.size,
- height: props.size,
- backgroundImage: props.image,
- backgroundSize: "cover",
- display: "inline-block"
- }}/>;
+export class AccountAvatar extends Component<AccountAvatarProps> {
+ render() {
+ var image = this.props.dummy ?
+ "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQYV2P4z/j/PwAHAQL/gXZXNQAAAABJRU5ErkJggg==)" :
+ this.props.image;
+ return <div style={{
+ width: this.props.size,
+ height: this.props.size,
+ backgroundImage: image,
+ backgroundSize: "cover",
+ display: "inline-block",
+ borderRadius: this.props.size / 2 * Number(this.props.round)
+ }}/>;
+ }
}