Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor previous commit
  • Loading branch information
aslamhadi committed Mar 25, 2017
commit 8ac351209e8ae7cf0df3c5707bcb306f8462dddf
19 changes: 12 additions & 7 deletions src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ const TopOptions = Loadable({
LoadingComponent: ComponentLoader
});

const NoAyatFound = (
<div className="text-center">
<h2><LocaleFormattedMessage id="chapter.index.ayatNotFound" defaultMessage="Ayat not found." /></h2>
</div>
);

class Surah extends Component {
static propTypes = {
chapter: surahType.isRequired,
Expand Down Expand Up @@ -231,6 +225,17 @@ class Surah extends Component {
return `${chapter.info ? chapter.info.shortDescription : ''} This Surah has ${chapter.versesCount} verses and resides between pages ${chapter.pages[0]} to ${chapter.pages[1]} in the Quran.`; // eslint-disable-line max-len
}

renderNoAyah() {
const { isLoading } = this.props;

const noAyah = (<div className="text-center">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: should this be named AyahNotFound to tally with the message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

<h2><LocaleFormattedMessage id="chapter.index.ayatNotFound" defaultMessage="Ayat not found." /></h2>
</div>
);

return isLoading ? <Loader isActive style={LoaderStyle} /> : noAyah;
}

renderPagination() {
const { isSingleAyah, isLoading, isEndOfSurah, chapter } = this.props;

Expand Down Expand Up @@ -347,7 +352,7 @@ class Surah extends Component {
const { chapter, options, actions } = this.props; // eslint-disable-line no-shadow
debug('component:Surah', 'Render');

if (!this.hasAyahs()) return <div className={style.container} style={{ margin: '50px auto' }}>{NoAyatFound}</div>;
if (!this.hasAyahs()) return <div className={style.container} style={{ margin: '50px auto' }}>{this.renderNoAyah()}</div>;

return (
<div className="chapter-body">
Expand Down