Skip to content

components/MediaNav

import { … } from 'zidane-ui'ui/src/components/MediaNav.tsx

Components#

MediaNavComponent#

Renders the previous / next chips (and the counter) over a set of media of two or more.

TypeScript
function MediaNav(props: MediaNavProps): Element | null
Parameters
NameTypeDescription
propsMediaNavProps

Component props: index, count, onStep, and whether to show the counter.

Element | null
MediaNav props
NameTypeDefaultDescription
className?string

Extra classes on each control.

countnumber

How many items there are. With fewer than two, nothing renders.

counter?booleanfalse

Also show the "n / N" chip, centred at the bottom.

indexnumber

Position of the item on show, from 0.

onStep(delta: -1 | 1) => void

Steps to the previous (-1) or next (1) item.

style?CSSProperties

Inline styles on each control.

ui/src/components/MediaNav.tsx:40

Constants#

MEDIA_CHIPConstant#

A round chip over media: the raised chip, which reads on a dark backdrop (IconButton's transparent look would not), at 40px, a larger target than IconButton's largest size. The lightbox's close button is one too.

TypeScript
const MEDIA_CHIP: 'zg-raised border absolute w-10 h-10 rounded-full text-[var(--zg-text)] flex items-center justify-center cursor-pointer p-0'

ui/src/components/MediaNav.tsx:16

Interfaces#

MediaNavPropsInterface#

Props for MediaNav.

TypeScript
interface MediaNavProps
MediaNavProps properties
NameTypeDefaultDescription
className?string

Extra classes on each control.

countnumber

How many items there are. With fewer than two, nothing renders.

counter?booleanfalse

Also show the "n / N" chip, centred at the bottom.

indexnumber

Position of the item on show, from 0.

onStep(delta: -1 | 1) => void

Steps to the previous (-1) or next (1) item.

style?CSSProperties

Inline styles on each control.

ui/src/components/MediaNav.tsx:20