-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3 - customer case split section (#841)
* feat(Text): adjust font sizes * feat(CustomerCase): main image top padding * fix(ImageBlock): handle missing image alt for preview * feat(CustomerCase): split section * feat(SplitSection): column flex on narrow screens * feat(SplitSection): hide empty section on narrow screens
- Loading branch information
Showing
21 changed files
with
356 additions
and
142 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
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
23 changes: 23 additions & 0 deletions
23
src/components/customerCases/customerCase/sections/CustomerCaseSection.tsx
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,23 @@ | ||
import { CustomerCaseSection as CustomerCaseSectionObject } from "studioShared/lib/interfaces/customerCases"; | ||
|
||
import ImageSection from "./image/ImageSection"; | ||
import QuoteBlock from "./quote/QuoteBlock"; | ||
import RichTextSection from "./richText/RichTextSection"; | ||
import SplitSection from "./splitSection/SplitSection"; | ||
|
||
export function CustomerCaseSection({ | ||
section, | ||
}: { | ||
section: CustomerCaseSectionObject; | ||
}) { | ||
switch (section._type) { | ||
case "splitSection": | ||
return <SplitSection section={section} />; | ||
case "richTextBlock": | ||
return <RichTextSection section={section} />; | ||
case "quoteBlock": | ||
return <QuoteBlock section={section} />; | ||
case "imageBlock": | ||
return <ImageSection section={section} />; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/components/customerCases/customerCase/sections/quote/QuoteBlock.tsx
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,29 @@ | ||
import Text from "src/components/text/Text"; | ||
import { QuoteBlock as QuoteBlockObject } from "studioShared/lib/interfaces/quoteBlock"; | ||
|
||
import styles from "./quoteBlock.module.css"; | ||
|
||
export interface QuoteBlockProps { | ||
section: QuoteBlockObject; | ||
} | ||
|
||
export default function QuoteBlock({ section }: QuoteBlockProps) { | ||
return ( | ||
section.quote && ( | ||
<div className={styles.quoteBlock}> | ||
<div | ||
className={`${styles.quoteBlockInner} ${section.author ? styles.withAuthor : styles.withoutAuthor}`} | ||
> | ||
<Text type="quoteNormal"> | ||
{"“"} | ||
{section.quote} | ||
{"”"} | ||
</Text> | ||
{section.author && ( | ||
<Text type="labelRegular">- {section.author}</Text> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/components/customerCases/customerCase/sections/quote/quoteBlock.module.css
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,26 @@ | ||
.quoteBlock { | ||
align-self: center; | ||
max-width: 960px; | ||
width: 100%; | ||
border: 2px solid var(--primary-yellow-warning); | ||
border-radius: 0.5rem; | ||
background-color: var(--primary-yellow-warning); | ||
} | ||
|
||
.quoteBlockInner { | ||
display: flex; | ||
flex-direction: column; | ||
background-color: var(--primary-bg); | ||
border-radius: 2rem; | ||
gap: 1.25rem; | ||
width: 100%; | ||
align-items: center; | ||
} | ||
|
||
.withAuthor { | ||
padding: 4.5rem 0.5rem 3.5rem 0.5rem; | ||
} | ||
|
||
.withoutAuthor { | ||
padding: 4.5rem 0.5rem; | ||
} |
35 changes: 35 additions & 0 deletions
35
src/components/customerCases/customerCase/sections/splitSection/SplitSection.tsx
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,35 @@ | ||
import { CustomerCaseSection } from "src/components/customerCases/customerCase/sections/CustomerCaseSection"; | ||
import { | ||
SplitSection as SplitSectionObject, | ||
SplitSectionSection as SplitSectionSectionObject, | ||
} from "studioShared/lib/interfaces/splitSection"; | ||
|
||
import styles from "./splitSection.module.css"; | ||
|
||
export interface SplitSectionProps { | ||
section: SplitSectionObject; | ||
} | ||
|
||
function SplitSectionSection({ | ||
section, | ||
}: { | ||
section: SplitSectionSectionObject; | ||
}) { | ||
switch (section._type) { | ||
case "emptySection": | ||
return <div className={styles.emptySection}></div>; | ||
} | ||
return <CustomerCaseSection section={section} />; | ||
} | ||
|
||
export default function SplitSection({ section }: SplitSectionProps) { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<div className={styles.content}> | ||
{section.sections.map((section) => ( | ||
<SplitSectionSection key={section._key} section={section} /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
28 changes: 28 additions & 0 deletions
28
src/components/customerCases/customerCase/sections/splitSection/splitSection.module.css
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,28 @@ | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.content { | ||
width: 100%; | ||
max-width: 960px; | ||
display: flex; | ||
justify-content: space-evenly; | ||
gap: 2rem; | ||
|
||
@media (max-width: 1024px) { | ||
flex-direction: column; | ||
} | ||
} | ||
|
||
.content > * { | ||
flex-basis: 0; | ||
flex-grow: 1; | ||
} | ||
|
||
.emptySection { | ||
@media (max-width: 1024px) { | ||
display: none; | ||
} | ||
} |
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
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
Oops, something went wrong.