1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

added lazy loading to NodeImageSwiperBlock

This commit is contained in:
Fedor Katurov 2022-12-06 21:00:37 +06:00
parent 991f829216
commit 10bb6f01b5
17 changed files with 210 additions and 106 deletions

View file

@ -1,49 +1,61 @@
import { FlowDisplayVariant, INode } from "~/types";
import { FlowDisplayVariant, INode } from '~/types';
export const URLS = {
BASE: "/",
LAB: "/lab",
BORIS: "/boris",
BASE: '/',
LAB: '/lab',
BORIS: '/boris',
AUTH: {
LOGIN: "/auth/login",
LOGIN: '/auth/login',
},
EXAMPLES: {
EDITOR: "/examples/edit",
IMAGE: "/examples/image",
EDITOR: '/examples/edit',
IMAGE: '/examples/image',
},
ERRORS: {
NOT_FOUND: "/lost",
BACKEND_DOWN: "/oopsie",
NOT_FOUND: '/lost',
BACKEND_DOWN: '/oopsie',
},
NODE_URL: (id: INode["id"] | string) => `/post${id}`,
NODE_URL: (id: INode['id'] | string) => `/post${id}`,
PROFILE_PAGE: (username: string) => `/profile/${username}`,
SETTINGS: {
BASE: "/settings",
NOTES: "/settings/notes",
TRASH: "/settings/trash",
BASE: '/settings',
NOTES: '/settings/notes',
TRASH: '/settings/trash',
},
NOTES: "/notes/",
NOTES: '/notes/',
NOTE: (id: number) => `/notes/${id}`,
};
export const ImagePresets = {
"1600": "1600",
"600": "600",
"300": "300",
cover: "cover",
small_hero: "small_hero",
avatar: "avatar",
flow_square: "flow_square",
flow_vertical: "flow_vertical",
flow_horizontal: "flow_horizontal",
export const imagePresets = {
'1600': '1600',
'900': '900',
'1200': '1200',
'600': '600',
'300': '300',
cover: 'cover',
small_hero: 'small_hero',
avatar: 'avatar',
flow_square: 'flow_square',
flow_vertical: 'flow_vertical',
flow_horizontal: 'flow_horizontal',
} as const;
export type ImagePreset = typeof imagePresets[keyof typeof imagePresets];
export const imageSrcSets: Partial<Record<ImagePreset, number>> = {
[imagePresets[1600]]: 1600,
[imagePresets[900]]: 900,
[imagePresets[1200]]: 1200,
[imagePresets[600]]: 600,
[imagePresets[300]]: 300,
};
export const flowDisplayToPreset: Record<
FlowDisplayVariant,
typeof ImagePresets[keyof typeof ImagePresets]
typeof imagePresets[keyof typeof imagePresets]
> = {
single: "flow_square",
quadro: "flow_square",
vertical: "flow_vertical",
horizontal: "flow_horizontal",
single: 'flow_square',
quadro: 'flow_square',
vertical: 'flow_vertical',
horizontal: 'flow_horizontal',
};