Refactor ReadAll content
This commit is contained in:
parent
0bf1033c4a
commit
429a9ae9fb
|
@ -35,23 +35,20 @@ export const OrganizedContent: React.FC<Props> = ({
|
||||||
}) => {
|
}) => {
|
||||||
const isReadAll = headings[currentIndex].name === "Read All";
|
const isReadAll = headings[currentIndex].name === "Read All";
|
||||||
const isMobile = false;
|
const isMobile = false;
|
||||||
|
const readAllContent = headings
|
||||||
if (isMobile) {
|
.filter((heading: { name: string }) => heading.name !== "Read All")
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{isReadAll ? (
|
|
||||||
<div>
|
|
||||||
{headings
|
|
||||||
.filter(
|
|
||||||
(heading: { name: string }) => heading.name !== "Read All"
|
|
||||||
)
|
|
||||||
.map((heading) => (
|
.map((heading) => (
|
||||||
<div key={heading.url}>
|
<div key={heading.url}>
|
||||||
<h2 className={styles.contentHeading}>{heading.name}</h2>
|
<h2 className={styles.contentHeading}>{heading.name}</h2>
|
||||||
{heading.content}
|
{heading.content}
|
||||||
</div>
|
</div>
|
||||||
))}
|
));
|
||||||
</div>
|
|
||||||
|
if (isMobile) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{isReadAll ? (
|
||||||
|
<div>{readAllContent}</div>
|
||||||
) : (
|
) : (
|
||||||
<h2 className={styles.contentHeading}>
|
<h2 className={styles.contentHeading}>
|
||||||
{headings[currentIndex].name}
|
{headings[currentIndex].name}
|
||||||
|
@ -67,18 +64,7 @@ export const OrganizedContent: React.FC<Props> = ({
|
||||||
<Nav headings={headings} currentIndex={currentIndex} link={Link} />
|
<Nav headings={headings} currentIndex={currentIndex} link={Link} />
|
||||||
<div>
|
<div>
|
||||||
{isReadAll ? (
|
{isReadAll ? (
|
||||||
<div>
|
<div>{readAllContent}</div>
|
||||||
{headings
|
|
||||||
.filter(
|
|
||||||
(heading: { name: string }) => heading.name !== "Read All"
|
|
||||||
)
|
|
||||||
.map((heading) => (
|
|
||||||
<div key={heading.url}>
|
|
||||||
<h2 className={styles.contentHeading}>{heading.name}</h2>
|
|
||||||
{heading.content}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<h2 className={styles.contentHeading}>
|
<h2 className={styles.contentHeading}>
|
||||||
{headings[currentIndex].name}
|
{headings[currentIndex].name}
|
||||||
|
|
Loading…
Reference in New Issue