From 0070b333e81fffe4d951d4a257fc5be4e14398b8 Mon Sep 17 00:00:00 2001 From: ajmaley Date: Sat, 27 Oct 2018 12:50:01 -0400 Subject: [PATCH] Forgot to add this file in my last commit --- src/components/FlameLinkStructure.js | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/components/FlameLinkStructure.js diff --git a/src/components/FlameLinkStructure.js b/src/components/FlameLinkStructure.js new file mode 100644 index 0000000..ccf4c7d --- /dev/null +++ b/src/components/FlameLinkStructure.js @@ -0,0 +1,54 @@ +import React, { Component, Fragment} from 'react'; +import Grid from '@material-ui/core/Grid'; +import Paper from '@material-ui/core/Paper'; +import Typography from '@material-ui/core/Typography'; +import flamelinkApp from '../flamelink.js'; + +class FlameLinkStructure extends Component { + constructor() { + super(); + + this.state = { + schemaContent: '', + } + + flamelinkApp.content.get('martenSchemaDemo') + .then(result => this.setState({ + schemaContent: result + })) + } + + getContent(key, type){ + if (type == 'text'){ + return this.state.schemaContent[key] + } + if (type == 'media'){ + for (var val in this.state.schemaContent[key]){ + console.log(this.state.schemaContent[key][val]); + flamelinkApp.storage.getURL(this.state.schemaContent[key][val]) + .then(url => console.log('File URL:', url)) + } + } + } + + render() { + const lg = this.props.field.gridColumns.lg; + const md = this.props.field.gridColumns.md; + const sm = this.props.field.gridColumns.sm; + const xs = this.props.field.gridColumns.xs; + return( + + + + HEADER + + + {this.getContent(this.props.field.key, this.props.type)} + + + + ); + } +} + +export default FlameLinkStructure; \ No newline at end of file