mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Add "other" type display
This commit is contained in:
parent
ff6855970e
commit
8f65aa7a2d
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
|
import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
|
||||||
|
import Panel from 'react-bootstrap/lib/Panel';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the component that implements display-specific functionality.
|
* This is the component that implements display-specific functionality.
|
||||||
@ -13,13 +14,27 @@ import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
let Other = React.createClass({
|
||||||
|
render() {
|
||||||
|
let ext = this.props.url.split('.').pop();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Panel className="media-other">
|
||||||
|
<p className="text-center">
|
||||||
|
.{ext}
|
||||||
|
</p>
|
||||||
|
</Panel>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let Image = React.createClass({
|
let Image = React.createClass({
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<a href={this.props.url} target="_blank" >
|
<a href={this.props.url} target="_blank" >
|
||||||
<img src={this.props.preview} />
|
<img src={this.props.preview} />
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,7 +80,8 @@ let Video = React.createClass({
|
|||||||
|
|
||||||
let resourceMap = {
|
let resourceMap = {
|
||||||
'image': Image,
|
'image': Image,
|
||||||
'video': Video
|
'video': Video,
|
||||||
|
'other': Other
|
||||||
}
|
}
|
||||||
|
|
||||||
let MediaPlayer = React.createClass({
|
let MediaPlayer = React.createClass({
|
||||||
@ -76,7 +92,7 @@ let MediaPlayer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let Component = resourceMap[this.props.mimetype] || Image;
|
let Component = resourceMap[this.props.mimetype] || Other;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ascribe-media-player">
|
<div className="ascribe-media-player">
|
||||||
|
@ -9,5 +9,10 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.media-other {
|
||||||
|
font-size: 500%;
|
||||||
|
color: #cccccc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user