aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/ui/image.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website/ts/components/ui/image.tsx')
-rw-r--r--packages/website/ts/components/ui/image.tsx49
1 files changed, 0 insertions, 49 deletions
diff --git a/packages/website/ts/components/ui/image.tsx b/packages/website/ts/components/ui/image.tsx
deleted file mode 100644
index d698ddaa0..000000000
--- a/packages/website/ts/components/ui/image.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import * as _ from 'lodash';
-import * as React from 'react';
-
-export interface ImageProps {
- className?: string;
- src?: string;
- fallbackSrc?: string;
- borderRadius?: string;
- width?: string | number;
- height?: string | number;
- maxWidth?: string | number;
- maxHeight?: string | number;
- additionalStyle?: React.CSSProperties;
-}
-interface ImageState {
- imageLoadFailed: boolean;
-}
-export class Image extends React.Component<ImageProps, ImageState> {
- constructor(props: ImageProps) {
- super(props);
- this.state = {
- imageLoadFailed: false,
- };
- }
- public render(): React.ReactNode {
- const src =
- this.state.imageLoadFailed || _.isUndefined(this.props.src) ? this.props.fallbackSrc : this.props.src;
- return (
- <img
- className={this.props.className}
- onError={this._onError.bind(this)}
- src={src}
- style={{
- ...this.props.additionalStyle,
- borderRadius: this.props.borderRadius,
- maxWidth: this.props.maxWidth,
- maxHeight: this.props.maxHeight,
- }}
- height={this.props.height}
- width={this.props.width}
- />
- );
- }
- private _onError(): void {
- this.setState({
- imageLoadFailed: true,
- });
- }
-}