Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Sanity to latest version numbers. #175

Merged
merged 3 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,557 changes: 665 additions & 1,892 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@portabletext/react": "^3.0.4",
"@sanity/client": "^6.1.3",
"@sanity/client": "^6.1.7",
"@sanity/dashboard": "^3.1.4",
"@sanity/icons": "^2.4.1",
"@sanity/image-url": "^1.0.2",
"@sanity/vision": "^3.12.2",
"@types/node": "20.3.1",
"@types/react": "18.2.14",
"@types/react-dom": "18.2.6",
"@sanity/vision": "^3.14.2",
"@types/node": "20.4.2",
"@types/react": "18.2.15",
"@types/react-dom": "18.2.7",
"class-variance-authority": "^0.6.1",
"clsx": "^1.2.1",
"clsx": "^2.0.0",
"country-code-emoji": "^2.3.0",
"framer-motion": "^10.12.18",
"framer-motion": "^10.12.21",
"fslightbox-react": "^1.7.6",
"next": "13.4.7",
"next-sanity": "^5.0.2",
"next-sitemap": "^4.1.3",
"next": "13.4.10",
"next-sanity": "^5.1.2",
"next-sitemap": "^4.1.8",
"phosphor-react": "^1.4.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-is": "^18.2.0",
"react-schemaorg": "^2.0.0",
"sanity": "^3.12.2",
"sanity": "^3.14.2",
"sanity-plugin-dashboard-widget-document-list": "^1.0.1",
"sanity-plugin-media": "^2.0.5",
"sanity-plugin-media": "^2.2.1",
"schema-dts": "^1.1.2",
"styled-components": "^5.3.11",
"tailwind-merge": "^1.13.2",
Expand All @@ -49,10 +49,10 @@
"devDependencies": {
"@types/fslightbox-react": "^1.7.3",
"autoprefixer": "^10.4.14",
"eslint": "^8.42.0",
"eslint-config-next": "13.4.7",
"eslint": "^8.45.0",
"eslint-config-next": "13.4.10",
"eslint-plugin-simple-import-sort": "^10.0.0",
"postcss": "^8.4.25",
"tailwindcss": "^3.3.2"
"postcss": "^8.4.26",
"tailwindcss": "^3.3.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Image from 'next/image';
import { FC } from 'react';

import { Section } from '~/components';
import { getImageProps } from '~/lib/sanityImage';

import { ImageBlockImage } from './ImageBlockImage';

interface ImageBlockProps {
caption?: string;
Expand All @@ -14,12 +14,7 @@ const ImageBlock: FC<ImageBlockProps> = ({ caption, image }) =>
<Section>
<figure className="contents">
<div className="col-span-12 lg:col-start-3">
<Image
className="w-full h-auto"
{...getImageProps(image, 1280)}
alt={image.asset?.alt || caption}
sizes="100vw"
/>
<ImageBlockImage caption={caption} image={image} />
</div>
{caption && (
<figcaption className="px-5 mt-4 md:mt-0 md:col-span-8 md:col-start-2 lg:col-span-6 lg:col-start-3 md:px-0 c-emphasis">
Expand Down
25 changes: 25 additions & 0 deletions src/components/types/ImageBlock/ImageBlockImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use client';

import Image from 'next/image';
import { FC } from 'react';

import { getImageProps } from '~/lib/sanityImage';

interface ImageBlockImageProps {
caption?: string;
image: ImageWithMeta;
}

export const ImageBlockImage: FC<ImageBlockImageProps> = ({
caption,
image,
}) => {
return (
<Image
className="w-full h-auto"
{...getImageProps(image, 1280)}
alt={image.asset?.alt || caption}
sizes="100vw"
/>
);
};
1 change: 1 addition & 0 deletions src/components/types/ImageBlock/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ImageBlock';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Image from 'next/image';
import { FC } from 'react';

import { Section } from '~/components';
import { getImageProps } from '~/lib/sanityImage';

import { InlineImagesImage } from './InlineImagesImage';

interface ImageGalleryBlockProps {
images: Array<{
Expand All @@ -18,13 +18,7 @@ const ImageGalleryBlock: FC<ImageGalleryBlockProps> = ({ images = [] }) => {
<Section>
<div className="flex flex-col items-center col-span-12 gap-8 sm:flex-row md:gap-12 lg:col-start-3">
{filteredImages.map(({ caption, image }) => (
<Image
key={image._id}
className="object-cover w-full h-auto"
{...getImageProps(image, 680)}
alt={image.asset.alt || caption || ''}
sizes="100vw"
/>
<InlineImagesImage key={image.id} caption={caption} image={image} />
))}
</div>
</Section>
Expand Down
26 changes: 26 additions & 0 deletions src/components/types/InlineImagesBlock/InlineImagesImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use client';

import Image from 'next/image';
import { FC } from 'react';

import { getImageProps } from '~/lib/sanityImage';

export interface InlineImagesImageProps {
caption?: string;
image: ImageWithMeta;
}

export const InlineImagesImage: FC<InlineImagesImageProps> = ({
caption,
image,
}) => {
return (
<Image
key={image._id}
className="object-cover w-full h-auto"
{...getImageProps(image, 680)}
alt={image.asset.alt || caption || ''}
sizes="100vw"
/>
);
};
1 change: 1 addition & 0 deletions src/components/types/InlineImagesBlock/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './InlineImagesBlock';
2 changes: 1 addition & 1 deletion src/sanity/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const readToken = process.env.SANITY_API_READ_TOKEN;

export const previewSecretDocumentId: `${string}.${string}` = 'preview.secret';

export const useCdn = false;
export const useCdn = true;

function assertValue<T>(v: T | undefined, errorMessage: string): T {
if (v === undefined) {
Expand Down
3 changes: 2 additions & 1 deletion src/sanity/lib/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createClient, groq } from 'next-sanity';
import { createClient } from '@sanity/client';
import { groq } from 'next-sanity';

import { apiVersion, dataset, projectId, useCdn } from '../env';

Expand Down