aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/app.ts
blob: 218d63bc6f3580e0a3ac867ea7614b1bd76e15c2 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { NextPage } from 'next';
import type { AppProps as NextAppProps } from 'next/app';
import type { ReactElement, ReactNode } from 'react';
import type { MessageFormatElement } from 'react-intl';
import type { VALID_THEMES } from '../utils/constants';

export type NextPageWithLayoutOptions = {
  isHome?: boolean;
};

export type NextPageWithLayout<T = object> = NextPage<T> & {
  getLayout?: (
    page: ReactElement,
    options: NextPageWithLayoutOptions
  ) => ReactNode;
};

// modified version - allows custom pageProps type, falling back to 'unknown'
type AppProps<P = unknown> = {
  pageProps: P;
} & Omit<NextAppProps<P>, 'pageProps'>;

type CustomPageProps = {
  translation: Record<string, string> | Record<string, MessageFormatElement[]>;
};

export type AppPropsWithLayout = AppProps<CustomPageProps> & {
  Component: NextPageWithLayout;
};

export type Position = 'bottom' | 'center' | 'left' | 'right' | 'top';

/** Spacing keys defined has CSS variables */
export type Spacing = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';

export type Validator<T> = (value: unknown) => value is T;

export type AckeeTrackerValue = 'full' | 'partial';

export type Theme = (typeof VALID_THEMES)[number];