Refine camera tag, standardize apple logo usage
This commit is contained in:
parent
ee32f6b947
commit
c958f75c73
@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import PhotoCamera from '@/camera/PhotoCamera';
|
||||||
import Badge from '@/components/Badge';
|
import Badge from '@/components/Badge';
|
||||||
import DivDebugBaselineGrid from '@/components/DivDebugBaselineGrid';
|
import DivDebugBaselineGrid from '@/components/DivDebugBaselineGrid';
|
||||||
import FieldSetWithStatus from '@/components/FieldSetWithStatus';
|
import FieldSetWithStatus from '@/components/FieldSetWithStatus';
|
||||||
@ -237,6 +238,18 @@ export default function ComponentsPage() {
|
|||||||
</div>,
|
</div>,
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div className={clsx(
|
||||||
|
debugComponents && '[&>*]:bg-gray-300 [&>*]:dark:bg-gray-700',
|
||||||
|
'[&>*]:flex',
|
||||||
|
)}>
|
||||||
|
{DEBUG_LINES.map((_, i) =>
|
||||||
|
<PhotoCamera
|
||||||
|
key={i}
|
||||||
|
camera={{ make: 'Canon', model: 'Canon EOS 800D' }}
|
||||||
|
contrast="high"
|
||||||
|
/>,
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</DivDebugBaselineGrid>
|
</DivDebugBaselineGrid>
|
||||||
</>}
|
</>}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export default function CameraHeader({
|
|||||||
return (
|
return (
|
||||||
<PhotoHeader
|
<PhotoHeader
|
||||||
camera={camera}
|
camera={camera}
|
||||||
entity={<PhotoCamera {...{ camera }} contrast="high" hideAppleIcon />}
|
entity={<PhotoCamera {...{ camera }} contrast="high" />}
|
||||||
entityDescription={
|
entityDescription={
|
||||||
descriptionForCameraPhotos(photos, undefined, count, dateRange)}
|
descriptionForCameraPhotos(photos, undefined, count, dateRange)}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { AiFillApple } from 'react-icons/ai';
|
import { AiFillApple } from 'react-icons/ai';
|
||||||
import { pathForCamera } from '@/site/paths';
|
import { pathForCamera } from '@/site/paths';
|
||||||
import { IoMdCamera } from 'react-icons/io';
|
import { IoMdCamera } from 'react-icons/io';
|
||||||
import { Camera, formatCameraText } from '.';
|
import { Camera, formatCameraText, isCameraApple } from '.';
|
||||||
import EntityLink, {
|
import EntityLink, {
|
||||||
EntityLinkExternalProps,
|
EntityLinkExternalProps,
|
||||||
} from '@/components/primitives/EntityLink';
|
} from '@/components/primitives/EntityLink';
|
||||||
@ -19,8 +19,8 @@ export default function PhotoCamera({
|
|||||||
hideAppleIcon?: boolean
|
hideAppleIcon?: boolean
|
||||||
countOnHover?: number
|
countOnHover?: number
|
||||||
} & EntityLinkExternalProps) {
|
} & EntityLinkExternalProps) {
|
||||||
const isCameraApple = camera.make?.toLowerCase() === 'apple';
|
const isApple = isCameraApple(camera);
|
||||||
const showAppleIcon = !hideAppleIcon && isCameraApple;
|
const showAppleIcon = !hideAppleIcon && isApple;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EntityLink
|
<EntityLink
|
||||||
@ -29,12 +29,12 @@ export default function PhotoCamera({
|
|||||||
icon={showAppleIcon
|
icon={showAppleIcon
|
||||||
? <AiFillApple
|
? <AiFillApple
|
||||||
title="Apple"
|
title="Apple"
|
||||||
className="translate-x-[-0.5px]"
|
className="translate-x-[-1px] translate-y-[-0.5px]"
|
||||||
size={15}
|
size={15}
|
||||||
/>
|
/>
|
||||||
: <IoMdCamera
|
: <IoMdCamera
|
||||||
size={12}
|
size={13}
|
||||||
className="translate-x-[-1px]"
|
className="translate-x-[-0.5px]"
|
||||||
/>}
|
/>}
|
||||||
type={type}
|
type={type}
|
||||||
badged={badged}
|
badged={badged}
|
||||||
|
|||||||
@ -55,6 +55,12 @@ export const cameraFromPhoto = (
|
|||||||
? { make: photo.make, model: photo.model }
|
? { make: photo.make, model: photo.model }
|
||||||
: fallback ?? CAMERA_PLACEHOLDER;
|
: fallback ?? CAMERA_PLACEHOLDER;
|
||||||
|
|
||||||
|
const isCameraMakeApple = (make?: string) =>
|
||||||
|
make?.toLocaleLowerCase() === 'apple';
|
||||||
|
|
||||||
|
export const isCameraApple = ({ make }: Camera) =>
|
||||||
|
isCameraMakeApple(make);
|
||||||
|
|
||||||
export const formatCameraText = (
|
export const formatCameraText = (
|
||||||
{ make, model: modelRaw }: Camera,
|
{ make, model: modelRaw }: Camera,
|
||||||
length:
|
length:
|
||||||
@ -74,7 +80,7 @@ export const formatCameraText = (
|
|||||||
case 'long':
|
case 'long':
|
||||||
return `${make} ${model}`;
|
return `${make} ${model}`;
|
||||||
case 'medium':
|
case 'medium':
|
||||||
return doesModelStartWithMake || make === 'Apple'
|
return doesModelStartWithMake || isCameraMakeApple(make)
|
||||||
? model
|
? model
|
||||||
: `${make} ${model}`;
|
: `${make} ${model}`;
|
||||||
case 'short':
|
case 'short':
|
||||||
|
|||||||
@ -2,9 +2,15 @@ import { Photo } from '../photo';
|
|||||||
import ImageCaption from './components/ImageCaption';
|
import ImageCaption from './components/ImageCaption';
|
||||||
import ImagePhotoGrid from './components/ImagePhotoGrid';
|
import ImagePhotoGrid from './components/ImagePhotoGrid';
|
||||||
import ImageContainer from './components/ImageContainer';
|
import ImageContainer from './components/ImageContainer';
|
||||||
import { Camera, cameraFromPhoto, formatCameraText } from '@/camera';
|
import {
|
||||||
|
Camera,
|
||||||
|
cameraFromPhoto,
|
||||||
|
formatCameraText,
|
||||||
|
isCameraApple,
|
||||||
|
} from '@/camera';
|
||||||
import { IoMdCamera } from 'react-icons/io';
|
import { IoMdCamera } from 'react-icons/io';
|
||||||
import { NextImageSize } from '@/services/next-image';
|
import { NextImageSize } from '@/services/next-image';
|
||||||
|
import { AiFillApple } from 'react-icons/ai';
|
||||||
|
|
||||||
export default function CameraImageResponse({
|
export default function CameraImageResponse({
|
||||||
camera: cameraProp,
|
camera: cameraProp,
|
||||||
@ -37,12 +43,20 @@ export default function CameraImageResponse({
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
fontFamily,
|
fontFamily,
|
||||||
icon: <IoMdCamera
|
icon: isCameraApple(camera)
|
||||||
size={height * .079}
|
? <AiFillApple
|
||||||
style={{
|
size={height * .09}
|
||||||
marginRight: height * .015,
|
style={{
|
||||||
}}
|
marginRight: height * .005,
|
||||||
/>,
|
transform: `translateY(${-height * .002}px)`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
: <IoMdCamera
|
||||||
|
size={height * .079}
|
||||||
|
style={{
|
||||||
|
marginRight: height * .015,
|
||||||
|
}}
|
||||||
|
/>,
|
||||||
}}>
|
}}>
|
||||||
{formatCameraText(camera).toLocaleUpperCase()}
|
{formatCameraText(camera).toLocaleUpperCase()}
|
||||||
</ImageCaption>
|
</ImageCaption>
|
||||||
|
|||||||
@ -59,7 +59,10 @@ export default function PhotoGridSidebar({
|
|||||||
/>}
|
/>}
|
||||||
{tags.length > 0 && <HeaderList
|
{tags.length > 0 && <HeaderList
|
||||||
title='Tags'
|
title='Tags'
|
||||||
icon={<FaTag size={12} className="text-icon" />}
|
icon={<FaTag
|
||||||
|
size={12}
|
||||||
|
className="text-icon translate-y-[1px]"
|
||||||
|
/>}
|
||||||
items={tagsIncludingHidden.map(({ tag, count }) => {
|
items={tagsIncludingHidden.map(({ tag, count }) => {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case TAG_FAVS:
|
case TAG_FAVS:
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export default function PhotoTag({
|
|||||||
href={pathForTag(tag)}
|
href={pathForTag(tag)}
|
||||||
icon={<FaTag
|
icon={<FaTag
|
||||||
size={11}
|
size={11}
|
||||||
className="translate-y-[1px]"
|
className="translate-y-[0.5px]"
|
||||||
/>}
|
/>}
|
||||||
type={type}
|
type={type}
|
||||||
badged={badged}
|
badged={badged}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user