Skip to content

Commit

Permalink
updated book and EGW book sections to have dynamic headings
Browse files Browse the repository at this point in the history
  • Loading branch information
okeino committed Oct 17, 2023
1 parent c5ad9c7 commit 5d18b10
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 24 deletions.
16 changes: 14 additions & 2 deletions public/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1359,12 +1359,24 @@
"value": "Discover Collections"
}
],
"discoverCollections_audiobooksHeading": [
{
"type": 0,
"value": "Discover Books"
}
],
"discoverCollections_conferencesHeading": [
{
"type": 0,
"value": "Conferences"
}
],
"discoverCollections_egwAudiobooksHeading": [
{
"type": 0,
"value": "Discover Ellen G. White"
}
],
"discoverCollections_storySeasonsHeading": [
{
"type": 0,
Expand Down Expand Up @@ -3836,7 +3848,7 @@
"organismSection__audiobooksHeading": [
{
"type": 0,
"value": "Discover Books"
"value": "Books"
}
],
"organismSection__audiobooksNext": [
Expand Down Expand Up @@ -3872,7 +3884,7 @@
"organismSection__egwAudiobooksHeading": [
{
"type": 0,
"value": "Discover Ellen G. White"
"value": "Ellen G. White"
}
],
"organismSection__egwAudiobooksNext": [
Expand Down
10 changes: 8 additions & 2 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,15 @@
"discoverCollections__title": {
"string": "Discover Collections"
},
"discoverCollections_audiobooksHeading": {
"string": "Discover Books"
},
"discoverCollections_conferencesHeading": {
"string": "Conferences"
},
"discoverCollections_egwAudiobooksHeading": {
"string": "Discover Ellen G. White"
},
"discoverCollections_storySeasonsHeading": {
"string": "Stories"
},
Expand Down Expand Up @@ -1813,7 +1819,7 @@
"string": "Sponsor"
},
"organismSection__audiobooksHeading": {
"string": "Discover Books"
"string": "Books"
},
"organismSection__audiobooksNext": {
"string": "Next audiobooks"
Expand All @@ -1831,7 +1837,7 @@
"string": "Previous Bible books"
},
"organismSection__egwAudiobooksHeading": {
"string": "Discover Ellen G. White"
"string": "Ellen G. White"
},
"organismSection__egwAudiobooksNext": {
"string": "Next EGW audiobooks"
Expand Down
19 changes: 11 additions & 8 deletions src/components/molecules/card/sequence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import BookIcon from '~public/img/icons/fa-book-light.svg';
import FeatherIcon from '~public/img/icons/fa-feather-light.svg';
import ListIcon from '~public/img/icons/fa-list-alt.svg';
import MusicIcon from '~public/img/icons/fa-music-light.svg';
import SeedlingIcon from '~public/img/icons/fa-seedling.svg';
import IconClosure from '~public/img/icons/icon-closure.svg';
import IconDisclosure from '~public/img/icons/icon-disclosure.svg';
import SuccessIcon from '~public/img/icons/icon-success-light.svg';
Expand Down Expand Up @@ -119,7 +120,7 @@ export default function CardSequence({
labelColor: BaseColors.DARK,
},
[SequenceContentType.StorySeason]: {
Icon: FeatherIcon,
Icon: SeedlingIcon,
accentColor: BaseColors.SALMON,
backgroundColor: BaseColors.STORY_B,
iconColor: BaseColors.WHITE,
Expand Down Expand Up @@ -174,13 +175,15 @@ export default function CardSequence({
ultralight
className={egw ? styles.bookReadBy : styles.bibleReadBy}
>
<FormattedMessage
id="cardSequence_readByLabel"
defaultMessage="Read By {name}"
values={{
name: (speakers.nodes || [])[0]?.name,
}}
/>
{(speakers.nodes || [])[0]?.name && (
<FormattedMessage
id="cardSequence_readByLabel"
defaultMessage="Read By {name}"
values={{
name: (speakers.nodes || [])[0]?.name,
}}
/>
)}
</Heading6>
)}
{summary && (
Expand Down
17 changes: 12 additions & 5 deletions src/components/organisms/cardSlider/section/audiobooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ import { useLanguageId } from '~src/lib/useLanguageId';
import { useInfiniteGetSectionAudiobooksQuery } from './__generated__/audiobooks';
import Section from './index';

export default function Audiobooks(): JSX.Element {
export default function Audiobooks(props: {
heading?: string | JSX.Element;
}): JSX.Element {
const intl = useIntl();
const lang = useLanguageId();

const {
heading = intl.formatMessage({
id: 'organismSection__audiobooksHeading',
defaultMessage: 'Books',
}),
} = props;

return (
<Section
infiniteQuery={useInfiniteGetSectionAudiobooksQuery}
heading={intl.formatMessage({
id: 'organismSection__audiobooksHeading',
defaultMessage: 'Discover Books',
})}
heading={heading}
previous={intl.formatMessage({
id: 'organismSection__audiobooksPrevious',
defaultMessage: 'Previous audiobooks',
Expand Down
17 changes: 12 additions & 5 deletions src/components/organisms/cardSlider/section/egwAudiobooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ import { useLanguageId } from '~src/lib/useLanguageId';
import { useInfiniteGetSectionEgwAudiobooksQuery } from './__generated__/egwAudiobooks';
import Section from './index';

export default function EgwAudiobooks(): JSX.Element {
export default function EgwAudiobooks(props: {
heading?: string | JSX.Element;
}): JSX.Element {
const intl = useIntl();
const lang = useLanguageId();

const {
heading = intl.formatMessage({
id: 'organismSection__egwAudiobooksHeading',
defaultMessage: 'Ellen G. White',
}),
} = props;

return (
<Section
infiniteQuery={useInfiniteGetSectionEgwAudiobooksQuery}
heading={intl.formatMessage({
id: 'organismSection__egwAudiobooksHeading',
defaultMessage: 'Discover Ellen G. White',
})}
heading={heading}
previous={intl.formatMessage({
id: 'organismSection__egwAudiobooksPrevious',
defaultMessage: 'Previous EGW audiobooks',
Expand Down
18 changes: 16 additions & 2 deletions src/containers/discover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,22 @@ export default function Discover(): JSX.Element {
/>
<TrendingTeachings />
<FeaturedTeachings />
<EgwAudiobooks />
<Audiobooks />
<EgwAudiobooks
heading={
<FormattedMessage
id="discoverCollections_egwAudiobooksHeading"
defaultMessage="Discover Ellen G. White"
/>
}
/>
<Audiobooks
heading={
<FormattedMessage
id="discoverCollections_audiobooksHeading"
defaultMessage="Discover Books"
/>
}
/>
<BlogPosts />
<BibleBooks
heading={
Expand Down

0 comments on commit 5d18b10

Please sign in to comment.