-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from avorg/style-sermon-meta
style sermon meta
- Loading branch information
Showing
8 changed files
with
114 additions
and
54 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import {useRouter} from "next/router"; | ||
import ErrorPage from "next/error"; | ||
import styles from "./detail.module.scss"; | ||
import React from "react"; | ||
|
||
|
||
export default function SermonDetail({sermon}) { | ||
const router = useRouter() | ||
|
||
if (!router.isFallback && !sermon) { | ||
return <ErrorPage statusCode={404}/> | ||
} | ||
|
||
const imageSrc = sermon.imageWithFallback.url, | ||
imageAlt = sermon.title; | ||
|
||
return ( | ||
<div> | ||
{router.isFallback ? ( | ||
<h1>Loading…</h1> | ||
) : ( | ||
<div> | ||
<div className={styles.meta}> | ||
{imageSrc ? <img src={imageSrc} alt={imageAlt}/> : null} | ||
<div> | ||
<h1>{sermon.title}</h1> | ||
<ul className={styles.speakers}> | ||
{sermon.persons.map(speaker => { | ||
return <li key={speaker.name}>{speaker.name}</li> | ||
})} | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
{sermon.recordingDate ? <p>{(new Date(sermon.recordingDate)).toLocaleDateString()}</p> : null} | ||
{sermon.audioFiles.map(file => { | ||
return <div key={file.url}> | ||
<audio controls src={file.url} preload={'metadata'}>Your browser doesn't support this | ||
player. | ||
</audio> | ||
</div> | ||
})} | ||
|
||
{sermon.description ? <div dangerouslySetInnerHTML={{__html: sermon.description}}/> : null} | ||
|
||
Other sermons: ... | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.meta { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 1rem; | ||
img { | ||
flex: 0 0 50px; | ||
margin-right: .75rem; | ||
border-radius: 100%; | ||
} | ||
h1 { | ||
margin: 0; | ||
} | ||
} | ||
|
||
.speakers { | ||
margin: 0; | ||
padding-left: 0; | ||
li { | ||
display: inline; | ||
list-style-type: none; | ||
font-style: italic; | ||
opacity: .5; | ||
} | ||
li:after { | ||
content: ", "; | ||
} | ||
li:last-child:after { | ||
content: ""; | ||
} | ||
} | ||
|
6 changes: 3 additions & 3 deletions
6
pages/[language]/sermons/[id].spec.js → containers/sermon/detail.spec.js
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
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