component
TestimonialPicture
The photo of the person behind a testimonial.
import { TestimonialPicture } from 'rost/components/testimonials-pics/TestimonialPicture'
<TestimonialPicture src="/people/client-1.jpg" alt="" />src/components/testimonials-pics/TestimonialPicture.tsx
import type { HTMLAttributes, ReactNode } from 'react'
import './testimonials-pics.css'
export interface TestimonialPictureProps extends HTMLAttributes<HTMLSpanElement> {
/** The photo. */
readonly src?: string
/** Who it is, for screen readers. Empty when the name is right next to it, as in Testimonials. */
readonly alt?: string
/** Your own image instead of `src`, e.g. a framework's image component. Give it the `rost-testimonials-pics__image` class. */
readonly children?: ReactNode
}
const b = 'rost-testimonials-pics'
/**
* The photo of the person behind a testimonial: a 56px square that
* Testimonials rounds. Built from contracts/testimonials-pics.contract.yaml.
* The photo is a slot, in Figma too.
*/
export function TestimonialPicture({ src, alt = '', children, className, ...rest }: TestimonialPictureProps) {
return (
<span className={[b, className].filter(Boolean).join(' ')} {...rest}>
{children ?? (src && <img className={`${b}__image`} src={src} alt={alt} />)}
</span>
)
}Props
| Prop | Type | Values | Default |
|---|---|---|---|
| picture | slot |
Where it's used
- runceanu.com
src/rost/testimonials-pics/TestimonialPicture.tsx.rost-testimonials-pics
Values
Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.
Never changes
| Part | Property | Value | Token |
|---|---|---|---|
| root | display | block | layout |
| root | position | relative | layout |
| root | overflow | hidden | layout |
| root | flex-shrink | 0 | layout |
| root | width | 56px | spacing/size/large |
| root | height | 56px | spacing/size/large |
| image | position | absolute | layout |
| image | inset | 0 | layout |
| image | width | 100% | layout |
| image | height | 100% | layout |
| image | object-fit | cover | Figma frame size |