forked from xuzuodong/personal-website
-
Notifications
You must be signed in to change notification settings - Fork 0
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
30 changed files
with
12,400 additions
and
8,272 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,3 +1,8 @@ | ||
import eslintConfig from '@sanomics/eslint-config' | ||
|
||
export default eslintConfig() | ||
export default eslintConfig({ | ||
ignores: [ | ||
'packages/app/types/sanity/index.ts', | ||
'packages/app/types/sanity/schemas.json', | ||
], | ||
}) |
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
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
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,13 +1,13 @@ | ||
<script setup lang="ts"> | ||
import type { ResolvedSanityImage } from '@sanity/asset-utils' | ||
import type { InstantFilmsQueryResult } from '~/types/sanity' | ||
const props = defineProps<{ | ||
instantFilms: { image: ResolvedSanityImage, orientation: 'portrait' | 'landscape' }[] | ||
instantFilms: { image: NonNullable<InstantFilmsQueryResult>[number], orientation: 'portrait' | 'landscape' }[] | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<div v-for="card in instantFilms" :key="card.image.asset._id" class="hidden"> | ||
<my-sanity-image :src="card.image.asset._id" preload :width="1440" :height="1440" /> | ||
<div v-for="card in instantFilms" :key="card.image.asset!._id" class="hidden"> | ||
<my-sanity-image :src="card.image.asset!._id" preload :width="1440" :height="1440" /> | ||
</div> | ||
</template> |
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,3 +1,17 @@ | ||
<script lang="ts"> | ||
import { imgProps } from '#image/components/nuxt-img' | ||
export default defineComponent({ | ||
props: { | ||
...imgProps, | ||
provider: { | ||
type: String, | ||
default: 'mySanity', | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<nuxt-img provider="mySanity" /> | ||
<nuxt-img v-bind="$props" /> | ||
</template> |
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
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
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
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
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
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
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
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
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,21 +1,13 @@ | ||
import type { ResolvedSanityImage } from '@sanity/asset-utils' | ||
import type { Value } from 'sanity-plugin-internationalized-array' | ||
|
||
export interface Gallery { | ||
name: Value[] | ||
photographDate: `${number}-${number}-${number}` | ||
description: Value[] | ||
images: ResolvedSanityImage[] | ||
} | ||
import type { GalleriesQueryResult } from '~/types/sanity' | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { slug } = getRouterParams(event) | ||
const query = groq`*[_type == "galleries" && slug.current == "${slug}"][0]{ | ||
const galleryQuery = groq`*[_type == "gallery" && slug.current == $slug][0]{ | ||
..., | ||
images[]{ | ||
..., | ||
asset-> | ||
} | ||
}` | ||
return await useSanity().fetch<Gallery | null>(query) | ||
return await useSanity().fetch<GalleriesQueryResult>(galleryQuery, { slug }) | ||
}) |
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
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,14 +1,14 @@ | ||
import type { ResolvedSanityImage } from '@sanity/asset-utils' | ||
import type { InstantFilmsQueryResult } from '~/types/sanity' | ||
|
||
const query = groq` | ||
*[_id == "instantFilms"].instantFilms[-5..-1]{ | ||
const instantFilmsQuery = groq` | ||
*[_type == "instantFilm"][0].instantFilms[-5..-1]{ | ||
..., | ||
asset->, | ||
} | ||
` | ||
|
||
export default defineCachedEventHandler(async () => { | ||
return await useSanity().fetch<ResolvedSanityImage[]>(query) | ||
return await useSanity().fetch<InstantFilmsQueryResult>(instantFilmsQuery) | ||
}, { | ||
staleMaxAge: 60 * 60, | ||
}) |
Oops, something went wrong.