@@ -10,6 +10,7 @@ import { cx } from "./lib/tools/cx";
1010// we could stop requiring users to import the hole CSS and only import on a
1111// per component basis.
1212import "./dsfr/component/quote/quote.css" ;
13+ import { FrClassName } from "./lib/generatedFromCss/classNames" ;
1314
1415export type QuoteProps = {
1516 className ?: string ;
@@ -19,18 +20,33 @@ export type QuoteProps = {
1920 sourceUrl ?: string ;
2021 image ?: string ;
2122 size ?: "md" | "lg" | "xl" ;
23+ accentColor ?: QuoteProps . AccentColor ;
2224} ;
2325
26+ export namespace QuoteProps {
27+ type ExtractAccentColor < FrClassName > = FrClassName extends `fr-quote--${infer AccentColor } `
28+ ? AccentColor
29+ : never ;
30+
31+ export type AccentColor = ExtractAccentColor < FrClassName > ;
32+ }
33+
2434/** @see <https://react-dsfr-components.etalab.studio/?path=/docs/components-quote> */
2535export const Quote = memo (
2636 forwardRef < HTMLDivElement , QuoteProps > ( ( props , ref ) => {
27- const { className, text, author, source, sourceUrl, image, size, ...rest } = props ;
37+ const { className, text, author, source, sourceUrl, image, size, accentColor, ...rest } =
38+ props ;
2839
2940 assert < Equals < keyof typeof rest , never > > ( ) ;
3041
3142 return (
3243 < figure
33- className = { cx ( fr . cx ( "fr-quote" ) , image && fr . cx ( "fr-quote--column" ) , className ) }
44+ className = { cx (
45+ fr . cx ( "fr-quote" ) ,
46+ image && fr . cx ( "fr-quote--column" ) ,
47+ accentColor && `fr-quote--${ accentColor } ` ,
48+ className
49+ ) }
3450 ref = { ref }
3551 >
3652 < blockquote cite = { sourceUrl } >
0 commit comments