remove: remove CollapseContent

This commit is contained in:
unknown
2021-09-08 20:43:49 +07:00
parent 51c8642d24
commit 1d833a3a7b
7 changed files with 48 additions and 60 deletions

View File

@@ -53,6 +53,7 @@
} }
.contentContainer { .contentContainer {
@apply hidden pb-16; @apply hidden pb-16;
padding-top: 1.6rem;
} }
@keyframes ContentAnimationIn { @keyframes ContentAnimationIn {
0% { 0% {

View File

@@ -1,12 +1,11 @@
import s from './CollapseChild.module.scss' import s from './CollapseChild.module.scss'
import { useState } from 'react' import { useState } from 'react'
import classNames from 'classnames' import classNames from 'classnames'
import CollapseContent from './CollapseContent/CollapseContent'
import Link from 'next/link' import Link from 'next/link'
interface CollapseProps{ interface CollapseProps{
title?: string, title?: string,
content: Array<string>, content: string,
isToggle?: boolean, isToggle?: boolean,
link?: string, link?: string,
} }
@@ -30,9 +29,7 @@ const CollapseChild = ({title, content, isToggle=false, link="/"}: CollapseProps
<div className={s.toggle}></div> <div className={s.toggle}></div>
</div> </div>
<div className={s.contentContainer}> <div className={s.contentContainer}>
{ {content}
content.map(item => <CollapseContent key={item} content={item} />)
}
</div> </div>
</div> </div>
) )

View File

@@ -1,3 +0,0 @@
.content {
margin-top: 1.6rem;
}

View File

@@ -1,15 +0,0 @@
import s from './CollapseContent.module.scss'
interface CollapseContentProps{
content: string
}
const CollapseContent = ({content}: CollapseContentProps) => {
return (
<div className={s.content}>
{content}
</div>
)
}
export default CollapseContent

View File

@@ -1,15 +1,15 @@
import CollapseChild from './CollapseChild/CollapseChild' import CollapseChild from './CollapseChild/CollapseChild'
interface CollapseCommonProps{ interface CollapseCommonProps{
data: {title: string, content: Array<string>, link: string}[], data: {title: string, content: string, link: string}[],
} }
const CollapseCommon = ({data}: CollapseCommonProps) => { const CollapseCommon = ({data}: CollapseCommonProps) => {
return ( return (
<section> <section>
{ {
data.map(item => data.map((item,index) =>
<CollapseChild key={item.title} title={item.title} content={item.content} link={item.link} /> <CollapseChild key={`${item.title}-${index}`} title={item.title} content={item.content} link={item.link} />
) )
} }
</section> </section>

View File

@@ -18,8 +18,9 @@
} }
} }
} }
.contentContainer { .content {
@apply pb-16; @apply pb-16;
padding-top: 1.6rem;
} }
} }
} }

View File

@@ -1,58 +1,67 @@
import { CollapseCommon, DateTime, HeadingCommon } from 'src/components/common' import { CollapseCommon, DateTime, HeadingCommon } from 'src/components/common'
import CollapseContent from 'src/components/common/CollapseCommon/CollapseChild/CollapseContent/CollapseContent'
import s from './DeliveryAndPolicyContent.module.scss' import s from './DeliveryAndPolicyContent.module.scss'
interface DeliveryAndPolicyContentProps{ interface DeliveryAndPolicyContentProps{
title?: string, title?: string,
date?: string, date?: string,
content?: Array<string>, content?: string,
} }
const HEADER_CONTENT = [ const HEADER_CONTENT =
"When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.", `When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.
"Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.",
"This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.", Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.
]
This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.`;
const DELIVERYANDPOLICY_DATA = [ const DELIVERYANDPOLICY_DATA = [
{ {
title: "This is a subtitle", title: "This is a subtitle",
content: [ content: `When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.
"When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.",
"Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.", Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.
"This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.",
], This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.`,
link: "/title" link: "/title"
}, },
{ {
title: "This is a subtitle", title: "This is a subtitle",
content: [ content: `When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.
"When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.",
"Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.", Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.
"This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.",
], This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.`,
link: "/title" link: "/title"
}, },
{ {
title: "This is a subtitle", title: "This is a subtitle",
content: [ content: `When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.
"When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.",
"Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.", Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.
"This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.",
], This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.`,
link: "/title" link: "/title"
}, },
{ {
title: "This is a subtitle", title: "This is a subtitle",
content: [ content: `When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.
"When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.",
"Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.", Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.
"This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.",
], This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.`,
link: "/title" link: "/title"
} },
{
title: "This is a subtitle",
content: `When youre trying to eat healthier but want something more substantial than a leafy green salad, broccoli salad is there for you. I love the crunch and heft of broccoli, especially when its cut up into bite size spoonable pieces.
Some people arent into raw broccoli, but I love it! I always go for the raw broccoli on those vegetable platters that seem to be at every potluck/party you go to.
This is a simple broccoli salad: you have the bulk of it, raw broccoli; crunchy red onions for a bit of acidity and raw crunch, craisins for sweetness, almonds for a nutty counter point; and a sweet and tangy soy-rice vinegar-sesame dressing.`,
link: "/title"
},
] ]
const DeliveryAndPolicyContent = ( { title="Delivery & Policy", date="APRIL 30", content = HEADER_CONTENT } : DeliveryAndPolicyContentProps) => { const DeliveryAndPolicyContent = ( { title="Delivery & Policy", date="APRIL 30, 2021", content = HEADER_CONTENT } : DeliveryAndPolicyContentProps) => {
return ( return (
<section className={s.wrapper}> <section className={s.wrapper}>
@@ -64,10 +73,8 @@ const DeliveryAndPolicyContent = ( { title="Delivery & Policy", date="APRIL 30",
</div> </div>
<HeadingCommon>{title}</HeadingCommon> <HeadingCommon>{title}</HeadingCommon>
</div> </div>
<div className={s.contentContainer}> <div className={s.content}>
{ {content}
content.map(item => <CollapseContent key={item} content={item} />)
}
</div> </div>
<CollapseCommon data={DELIVERYANDPOLICY_DATA} /> <CollapseCommon data={DELIVERYANDPOLICY_DATA} />
</div> </div>