Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 7x 19x 19x 38x 7x 5x 5x 5x 5x | import type { Work } from "~/types/Work";
import { toWork, WORK_FIELDS, WORK_PATH } from "~/utils/work";
/** Read straight from the `work` collection, in the order the files give. */
export const useWorkList = () =>
useAsyncData(
"work",
async () =>
(
await queryCollection("work")
.select(...WORK_FIELDS)
.order("order", "ASC")
.all()
).map(toWork),
{ default: (): Work[] => [] },
);
export const useWorkEntry = (slug: MaybeRefOrGetter<string>) =>
useAsyncData(
() => `work-${toValue(slug)}`,
() =>
queryCollection("work")
.path(`${WORK_PATH}${toValue(slug)}`)
.first(),
{ watch: [() => toValue(slug)] },
);
|