-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
635faf6
commit 6881002
Showing
11 changed files
with
152 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"main.css": "static/css/main.5ebcd27d.css", | ||
"main.css.map": "static/css/main.5ebcd27d.css.map", | ||
"main.js": "static/js/main.a390ee5c.js", | ||
"main.js.map": "static/js/main.a390ee5c.js.map" | ||
"main.js": "static/js/main.46f245bc.js", | ||
"main.js.map": "static/js/main.46f245bc.js.map" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"><link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/gita/manifest.json"><link rel="shortcut icon" href="/gita/favicon.ico"><title>Bhagavada Gita - Rossoskull</title><link href="/gita/static/css/main.5ebcd27d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" onload='console.log("Helo helo")'></div><script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script><script src="script.js"></script><script type="text/javascript" src="/gita/static/js/main.a390ee5c.js"></script></body></html> | ||
<!doctype html><html lang="en"><head><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"><link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/gita/manifest.json"><link rel="shortcut icon" href="/gita/favicon.ico"><title>Bhagavada Gita - Rossoskull</title><link href="/gita/static/css/main.5ebcd27d.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" onload='console.log("Helo helo")'></div><script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script><script src="script.js"></script><script type="text/javascript" src="/gita/static/js/main.46f245bc.js"></script></body></html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,111 @@ | ||
import React, { Component } from 'react'; | ||
import { Divider, ExpansionPanel, ExpansionPanelSummary, ExpansionPanelDetails, Typography } from '@material-ui/core'; | ||
import { ExpandMore } from '@material-ui/icons'; | ||
|
||
class Verses extends Component { | ||
|
||
state = { | ||
verses: null, | ||
chapter: null, | ||
expanded: '' | ||
} | ||
|
||
render() { | ||
|
||
const styles = { | ||
hr: { | ||
backgroundColor: 'rgba(255,255,255,0.5)', | ||
width: '85%', | ||
margin: '0 auto', | ||
marginBottom: '8px' | ||
}, | ||
|
||
expansionPanel: { | ||
marginBottom: '5px', | ||
backgroundColor: '#2196f3', | ||
color: 'white' | ||
} | ||
} | ||
|
||
const { ch, acc_token} = this.props; | ||
|
||
if ( this.state.chapter !== this.props.chapters[ch] ) { | ||
this.setState({ | ||
chapter: this.props.chapters[ch] | ||
}) | ||
} | ||
|
||
if ( this.state.verses == null ) { | ||
const baseUrl = 'https://bhagavadgita.io/api/v1/'; | ||
const url = `${baseUrl}chapters/${ch}/verses?access_token=${acc_token}`; | ||
const options = { | ||
'mode': 'cors', | ||
} | ||
|
||
// Fetch Verses from the desired chapter | ||
fetch(url, options) | ||
.then((res) => { | ||
if(res.ok) { | ||
res.json().then((data) => { | ||
const versesData = data.map((verse) => { | ||
return( | ||
<ExpansionPanel style={styles.expansionPanel}> | ||
<ExpansionPanelSummary | ||
expandIcon={ | ||
<ExpandMore style={{color: 'white'}} /> | ||
} | ||
> | ||
<Typography variant='h5' color='inherit'> | ||
{verse.text} | ||
</Typography> | ||
</ExpansionPanelSummary> | ||
<ExpansionPanelDetails style={{display: 'block'}} > | ||
<Typography gutterBottom style={{width: '100%'}} variant='subtitle2' color='inherit'> | ||
» Transliteration | ||
</Typography> | ||
|
||
<Typography gutterBottom color='inherit' variant='h6' > | ||
{verse.transliteration} | ||
</Typography> | ||
<Divider style={styles.hr}/> | ||
|
||
<Typography gutterBottom variant='subtitle2' color='inherit'> | ||
» Meaning | ||
</Typography> | ||
|
||
<Typography gutterBottom color='inherit' variant='h6' > | ||
{verse.meaning} | ||
</Typography> | ||
<Divider style={styles.hr}/> | ||
|
||
<Typography gutterBottom variant='subtitle2' color='inherit'> | ||
» Word Meanings | ||
</Typography> | ||
|
||
<Typography gutterBottom color='inherit' variant='h6' > | ||
{verse.word_meanings} | ||
</Typography> | ||
</ExpansionPanelDetails> | ||
</ExpansionPanel> | ||
); | ||
}); | ||
this.setState({ verses: versesData }); | ||
}); | ||
} else { | ||
console.log('Error in retrieving verses'); | ||
} | ||
}) | ||
.catch((err) => { | ||
console.log('verses error', err); | ||
}); | ||
} | ||
|
||
return( | ||
<div> | ||
<h3>Verses : {this.props.match.params.ch}</h3> | ||
</div> | ||
{this.state.verses} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Verses; | ||
export default Verses; |