Created Flamelink component to grab data from flamelink and sends data to the <p id="flamelinkDemo"> tag. Still need to firgure out how to grab all fields and display without hardcoding.

Added my Flamelink instance to Main.js and added it as a prop for the Info component.
Info.js calls the Flamelink component and pushes the Flamelink instance to the Flamelink component as a prop.
This commit is contained in:
ajmaley
2018-10-04 18:35:36 -04:00
parent a144e9f805
commit 987c89837f
6 changed files with 2990 additions and 18 deletions

View File

@@ -0,0 +1,14 @@
import React, { Component } from 'react';
class Flamelink extends Component {
render() {
//Grabs data from text field in entry from the martenSchemaDemo
this.props.flamelinkApp.content.get('martenSchemaDemo')
.then(flameData => document.getElementById("flamelinkDemo").innerHTML = flameData.field_1538162314419);
return(null);
}
}
export default Flamelink;

View File

@@ -10,6 +10,7 @@ import Map from '../pages/Map';
import Quiz from '../pages/Quiz';
import Sighting from '../pages/Sighting';
import Info from '../pages/Info';
import flamelink from 'flamelink';
function TabContainer(props) {
return (
@@ -30,6 +31,15 @@ const styles = theme => ({
},
});
const flamelinkApp = flamelink({
apiKey: "AIzaSyAYf9AbeYwLY892NRiQfn0AMtG9xIFAJbo",
authDomain: "marten-application.firebaseapp.com",
databaseURL: "https://marten-application.firebaseio.com",
projectId: "marten-application",
storageBucket: "marten-application.appspot.com",
messagingSenderId: "659856510832"
});
class SimpleTabs extends React.Component {
state = {
value: 0,
@@ -58,7 +68,7 @@ class SimpleTabs extends React.Component {
{value === 1 && <Sighting/>}
{value === 2 && <Quiz/>}
{value === 3 && <Map/>}
{value === 4 && <Info/>}
{value === 4 && <Info flamelinkApp={flamelinkApp}/>}
</div>
);
}