mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
show image
This commit is contained in:
@@ -6,9 +6,7 @@ import { DownloadButton } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
file: File,
|
||||
revision: string,
|
||||
classes: any
|
||||
file: File
|
||||
};
|
||||
|
||||
class DownloadViewer extends React.Component<Props> {
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import type { File } from "@scm-manager/ui-types";
|
||||
|
||||
type Props = {
|
||||
t: string => string
|
||||
t: string => string,
|
||||
file: File
|
||||
};
|
||||
|
||||
type State = {
|
||||
content: string
|
||||
};
|
||||
|
||||
class ImageViewer extends React.Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
content: ""
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {}
|
||||
|
||||
class ImageViewer extends React.Component<Props> {
|
||||
render() {
|
||||
return "ImageViewer";
|
||||
const { file } = this.props;
|
||||
return (
|
||||
<div className="has-text-centered">
|
||||
<figure>
|
||||
<img src={file._links.self.href} />
|
||||
</figure>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ class Content extends React.Component<Props, State> {
|
||||
const { file, revision } = this.props;
|
||||
const contentType = this.state.contentType;
|
||||
if (contentType.startsWith("image")) {
|
||||
return <ImageViewer />;
|
||||
return <ImageViewer file={file} />;
|
||||
} else if (contentType.startsWith("text")) {
|
||||
return <SourcecodeViewer />;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user