-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build quote component and resolve dm mono font styles
- Loading branch information
1 parent
246f0f2
commit 2afcecf
Showing
28 changed files
with
151 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { cnb } from "cnbuilder"; | ||
|
||
export const verticalAlignments = { | ||
top: "justify-start", | ||
center: "justify-center", | ||
bottom: "justify-end", | ||
}; | ||
export type QuoteVerticalAlignType = keyof typeof verticalAlignments; | ||
|
||
export const root = (quoteOnRight: boolean) => | ||
cnb("relative break-words flex flex-col lg:max-w-prose-wide lg:ml-0", { | ||
"rs-pl-4": !quoteOnRight, | ||
"rs-pr-4": quoteOnRight, | ||
}); | ||
export const teaserWrapper = "w-fit gap-9"; | ||
export const quoteMark = (isLargeTeaser: boolean) => | ||
cnb("shrink-0 leading-[0]", { | ||
"text-[clamp(16rem,7.46vw+13.31rem,26rem)] mt-[clamp(6rem,4.03vw+4.55rem,11.4rem)]": | ||
!isLargeTeaser, | ||
"text-[clamp(17rem,11.19vw+12.97rem,32rem)] mt-[clamp(6rem,4.03vw+4.55rem,11.4rem)]": | ||
isLargeTeaser, | ||
}); | ||
export const teaser = "rs-mb-0 grow-0 w-fit"; | ||
export const body = "mt-02em first:mt-0 whitespace-pre-line"; | ||
export const source = "rs-mt-1 whitespace-pre-line"; |
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,79 @@ | ||
import { AnimateInView, type AnimationType } from "@/components/Animate"; | ||
import { Container } from "@/components/Container"; | ||
import { Text } from "@/components/Typography"; | ||
import * as styles from "./Quote.styles"; | ||
import { cnb } from "cnbuilder"; | ||
|
||
export type QuoteProps = React.HTMLAttributes<HTMLDivElement> & { | ||
teaser?: string; | ||
body?: string; | ||
source?: string; | ||
addDarkOverlay?: boolean; | ||
isLargeTeaser?: boolean; | ||
isLargeBody?: boolean; | ||
isMinimal?: boolean; | ||
quoteOnRight?: boolean; | ||
animation?: AnimationType; | ||
delay?: number; | ||
}; | ||
|
||
export const Quote = ({ | ||
teaser, | ||
body, | ||
addDarkOverlay, | ||
isMinimal, | ||
isLargeTeaser = false, | ||
isLargeBody, | ||
source, | ||
animation = "slideUp", | ||
quoteOnRight = false, | ||
delay, | ||
children, | ||
className, | ||
...props | ||
}: QuoteProps) => { | ||
return ( | ||
<AnimateInView animation={animation} delay={delay}> | ||
<Container | ||
width="full" | ||
py={addDarkOverlay && !isMinimal ? 5 : undefined} | ||
className={cnb(styles.root(quoteOnRight), className)} | ||
{...props} | ||
> | ||
<blockquote> | ||
{teaser && ( | ||
<> | ||
<Text font="serif" className={styles.quoteMark(isLargeTeaser)}> | ||
{quoteOnRight ? "”" : "“"} | ||
</Text> | ||
<Text | ||
size={isLargeTeaser ? "f5" : "f4"} | ||
leading="none" | ||
font="dm-sans" | ||
className={styles.teaser} | ||
> | ||
{teaser} | ||
</Text> | ||
</> | ||
)} | ||
{body && ( | ||
<Text | ||
variant={isLargeBody ? undefined : "big"} | ||
leading="display" | ||
size={isLargeBody ? 2 : undefined} | ||
font="dm-sans" | ||
className={styles.body} | ||
> | ||
{body}" | ||
</Text> | ||
)} | ||
{source && ( | ||
<Text variant="card" font="dm-mono" className={styles.source}> | ||
{source} | ||
</Text> | ||
)} | ||
</blockquote> | ||
</Container> | ||
</AnimateInView> | ||
); | ||
}; |
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 @@ | ||
export * from "./Quote"; |
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
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...next/static/chunks/55-9aef664ea63fabe2.js → ...next/static/chunks/55-945056ea4e51be19.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ext/static/chunks/835-b07d7a7b64fa8faa.js → ...ext/static/chunks/673-1db8d1a55977ccb2.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ext/static/chunks/411-c8bd97c4bfa00249.js → ...ext/static/chunks/890-37e8c633a343a2e0.js
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.