Skip to content

Commit

Permalink
implement external-id snaks; #9
Browse files Browse the repository at this point in the history
  • Loading branch information
hobofan committed Sep 15, 2016
1 parent 5b2bff8 commit 7406bad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Wikidata/Snak.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from 'react'

import ExternalIdSnak from './Snak/ExternalIdSnak'
import MonolingualTextSnak from './Snak/MonolingualTextSnak'
import StringSnak from './Snak/StringSnak'

class Snak extends React.Component {
render() {
switch(this.props.snak.datatype) {
case "external-id":
return (
<ExternalIdSnak snak={this.props.snak} />
);
break;
case "monolingualtext":
return (
<MonolingualTextSnak snak={this.props.snak} />
Expand Down
26 changes: 26 additions & 0 deletions src/components/Wikidata/Snak/ExternalIdSnak.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'

import {Card, CardText} from 'material-ui/Card';

class ExternalIdSnak extends React.Component {
render() {
return (
<Card>
<CardText>
<label>
{
/* TODO use formating to get clickable url */
(this.props.snak.datavalue.value)
}
</label>
</CardText>
</Card>
);
}
}

ExternalIdSnak.propTypes = {
snak: React.PropTypes.object.isRequired,
}

export default ExternalIdSnak

0 comments on commit 7406bad

Please sign in to comment.