mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 21:46:49 +00:00
ba70ad28b8
Arabic runs the app right to left, but margins, paddings, insets, text alignment, borders and corner radii were written for the left side, so icons sat against the wrong edge of their labels, indents and badges pointed the wrong way and amount columns aligned left. They now use the logical forms (ms-, ps-, start-, text-start, marginInlineStart, insetInlineEnd and their CSS equivalents), which are the very same sides in a left to right language. Geometry stays physical on purpose: maps, positions measured from the pointer or a bounding box, time axes, sliders, transforms and print output. Amounts drawn as several spans keep their order in a right to left row, the time picker keeps hours before minutes, and two switches whose thumb slid out of its track in Arabic now move the right way. lint:rtl counts what is still physical per file against a baseline that may only shrink (1512 uses in 370 files before, 319 in 113 now), and CI runs it, so new code reaches for the logical forms.
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import React from 'react'
|
|
import { X } from 'lucide-react'
|
|
import { useTranslation } from '../../i18n'
|
|
import { useHelpStore } from '../../store/helpStore'
|
|
|
|
/** A step picture enlarged over the help dialog; click anywhere or Escape to close. */
|
|
export default function HelpLightbox(): React.ReactElement | null {
|
|
const { t } = useTranslation()
|
|
const lightbox = useHelpStore(s => s.lightbox)
|
|
const close = useHelpStore(s => s.openLightbox)
|
|
if (!lightbox) return null
|
|
|
|
return (
|
|
<div
|
|
className="trek-help-lightbox fixed inset-0 z-[var(--z-overlay)] flex items-center justify-center p-4 sm:p-8 bg-[var(--overlay)] backdrop-blur-sm"
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-label={lightbox.alt}
|
|
onClick={() => close(null)}
|
|
>
|
|
<button
|
|
type="button"
|
|
onClick={() => close(null)}
|
|
aria-label={t('help.center.close')}
|
|
className="absolute top-4 end-4 w-10 h-10 rounded-full bg-inverse text-inverse-text flex items-center justify-center shadow-elevated hover:scale-105 transition-transform"
|
|
>
|
|
<X className="w-5 h-5" />
|
|
</button>
|
|
<figure className="trek-help-lightbox-card max-w-[min(1400px,94vw)] max-h-[90vh] flex flex-col gap-3" onClick={e => e.stopPropagation()}>
|
|
<img src={lightbox.src} alt={lightbox.alt} className="max-h-[84vh] w-auto object-contain rounded-xl border border-edge shadow-modal bg-surface-card" />
|
|
{lightbox.alt && <figcaption className="text-caption text-center text-inverse-text opacity-80">{lightbox.alt}</figcaption>}
|
|
</figure>
|
|
</div>
|
|
)
|
|
}
|