Skip to content

Self-hosted house planner: true-scale 2D floor plan, 3D, satellite map overlay, sewer, electrical, water and underfloor heating with calculations, priced bill of materials. React + PHP, no database. By the team behind homedesignsai.pro

689 B
Raw Blame
import { gridSteps } from '../canvas/camera'
import { useTranslation } from 'react-i18next'
import { formatNumber } from '../model'
import { t as tr } from '../i18n'

const size = (mm: number) => (mm >= 1000 ? `${formatNumber(mm / 1000, 2)} ${tr('common:units.m')}` : `${formatNumber(mm / 10, 1)} ${tr('common:units.cm')}`)

export function GridLegend({ scale }: { scale: number }) {
  const { t } = useTranslation('common')
  const { minor, major } = gridSteps(scale)
  return (
    <span className="grid-legend muted" title={t('grid.title')}>
      <span className="grid-legend__cell" aria-hidden />
      {t('grid.legend', { minor: size(minor), major: size(major) })}
    </span>
  )
}