1
0
Fork 0
blog/src/components/atoms/Exif.tsx

59 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-05-22 14:38:19 +02:00
import React, { ReactElement } from 'react'
import * as styles from './Exif.module.css'
2023-01-29 22:58:19 +01:00
import ExifMap from './ExifMap'
2019-11-17 14:18:49 +01:00
import Icon from './Icon'
const ExifData = ({
title,
value,
icon
}: {
title: string
value: string
icon: string
}) => (
<span title={title}>
<Icon name={icon} />
{value}
</span>
)
2019-10-02 13:35:50 +02:00
export default function Exif({
exif
}: {
exif: Queries.ImageExif
}): ReactElement {
2021-05-23 13:38:15 +02:00
const { iso, model, fstop, shutterspeed, focalLength, exposure, gps } =
exif.formatted
2019-10-02 13:35:50 +02:00
2021-11-28 20:05:38 +01:00
const formattedModel = model === 'FC7203' ? 'DJI Mavic Mini' : model
2019-10-02 13:35:50 +02:00
return (
<aside className={styles.exif}>
<div className={styles.data}>
2021-11-28 20:05:38 +01:00
{formattedModel && (
<ExifData title="Camera model" value={formattedModel} icon="Camera" />
)}
2019-11-17 14:18:49 +01:00
{focalLength && (
<ExifData title="Focal length" value={focalLength} icon="Crosshair" />
)}
{fstop && <ExifData title="Aperture" value={fstop} icon="Aperture" />}
{shutterspeed && (
<ExifData
title="Shutter speed"
value={shutterspeed}
icon="Stopwatch"
/>
)}
{exposure && <ExifData title="Exposure" value={exposure} icon="Sun" />}
{iso && <ExifData title="ISO" value={iso} icon="Maximize" />}
2019-10-02 13:35:50 +02:00
</div>
{gps?.latitude && (
<div className={styles.map}>
2019-10-13 00:07:02 +02:00
<ExifMap gps={gps} />
</div>
)}
2019-10-02 13:35:50 +02:00
</aside>
)
}