okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
0b3299a01
main
1import { tr } from '../lib/i18n' ; 2/** The approved three-bar mark and outlined wordmark, sized as artwork. */ 3import { useEffect , useState , type CSSProperties } from 'react' ; 4import { useMedia } from '../lib/responsive' ; 5import { useStore } from '../lib/store' ; 6export function Brand ({ variant, height, decorative= false , className= '' , } :{ 7variant :'mark' | 'lockup' ; 8height :number ; 9decorative ?:boolean ; 10className ?:string ; 11}) { 12const preference = useStore ( s => s . theme ); 13const systemDark = useMedia ( '(prefers-color-scheme: dark)' ); 14const theme = preference === 'system' ?( systemDark ?'dark' :'light' ) :preference ; 15const src = `/brand/strata- ${ variant } - ${ theme } .svg` ; 16const [ failed , setFailed ] = useState ( false ); 17useEffect (() => setFailed ( false ), [ src ]); 18const width = variant === 'mark' ?height :height * 182 / 48 ; 19const style = { width, height} satisfies CSSProperties ; 20return < span className = { `brand brand-- ${ variant } ${ className } ` } style = { style } role = { decorative ?undefined :'img' } aria-label = { tr ( decorative ?undefined :'Strata' )} aria-hidden = { decorative || undefined }> 21{ tr ( ! failed ?< img className = "brand__img" src = { src } width = { width } height = { height } alt = { tr ( "" )} onError = {() => setFailed ( true )}/> :null )} 22< span className = "brand__fallback" aria-hidden = "true" >{ tr ( variant === 'mark' ?'S' :'Strata' )}</ span > 23</ span >; 24}