-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
images: { | ||
remotePatterns: [ | ||
{ | ||
hostname: 'cdn.sanity.io', | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
export default nextConfig; | ||
export default nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import Container from '#/Global/Container' | ||
import Hero from '##/index/Hero' | ||
import Projects from '@/components/App/index/Projects' | ||
|
||
export default function Index() { | ||
return ( | ||
<Container> | ||
<Hero /> | ||
<Projects /> | ||
</Container> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {unstable_noStore as noStore} from 'next/cache' | ||
import {client, urlForImage} from '@/lib/sanity' | ||
|
||
import Link from 'next/link' | ||
import Image from 'next/image' | ||
|
||
import {Text} from '#/UI/Text' | ||
|
||
interface Project { | ||
name: string | ||
link?: string | ||
id: number | ||
description: string | ||
image: Array<{asset: {url: string}}> | ||
in_development: boolean | ||
} | ||
|
||
const getData = async (): Promise<Project[]> => { | ||
noStore() | ||
|
||
const query = ` | ||
*[_type == 'project'] { | ||
name, | ||
link, | ||
id, | ||
description, | ||
image, | ||
in_development, | ||
}` | ||
|
||
const data: Project[] = await client.fetch(query) | ||
return data | ||
} | ||
|
||
const Projects = async () => { | ||
const projects: Project[] = await getData() | ||
|
||
if (!projects) { | ||
return <mark>Произошла ошибка при получении данных!</mark> | ||
} | ||
|
||
return ( | ||
<section data-section="projects-index" className="mt-8"> | ||
<Text type="heading">my projects</Text> | ||
|
||
{projects.map((slide, index) => ( | ||
<article className="space-y-5 mt-5" key={index}> | ||
<div className="s-32"> | ||
<Image quality={100} priority={true} className="object-cover w-full h-full" src={urlForImage(slide.image).url()} width={100} height={100} alt={slide.name} /> | ||
</div> | ||
|
||
<div> | ||
<Text type="heading">{slide.name}</Text> | ||
<Text>{slide.description}</Text> | ||
</div> | ||
</article> | ||
))} | ||
</section> | ||
) | ||
} | ||
|
||
export default Projects |