Files
suwayomi-material-you-webui/src/base/Base.types.ts

75 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-10-05 19:33:09 +02:00
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
2024-10-03 04:03:04 +02:00
import { ReactNode } from 'react';
import { ParseKeys } from 'i18next';
2024-10-03 04:03:04 +02:00
2024-10-05 19:33:09 +02:00
export enum GridLayout {
Compact = 0,
Comfortable = 1,
List = 2,
}
2024-10-03 04:03:04 +02:00
export enum DirectionOffset {
PREVIOUS = -1,
NEXT = 1,
}
export type TranslationKey = ParseKeys;
2024-10-28 18:03:29 +01:00
interface DisplayDataTranslationKey {
isTitleString?: never;
title: TranslationKey;
icon: ReactNode;
}
interface DisplayDataString {
isTitleString: true;
title: string;
icon: ReactNode;
}
type DisplayData = DisplayDataTranslationKey | DisplayDataString;
export type ValueToDisplayData<Value extends string | number> = Record<Value, DisplayData>;
2024-11-04 18:00:35 +01:00
export interface MultiValueButtonBaseProps<Value extends string | number> {
tooltip?: string;
2024-11-04 18:00:35 +01:00
value: Value;
defaultValue?: Value;
2024-11-04 18:00:35 +01:00
values: Value[];
setValue: (value: Value) => void;
valueToDisplayData: ValueToDisplayData<Value>;
}
export interface MultiValueButtonDefaultableProps<Value extends string | number>
extends OptionalProperty<MultiValueButtonBaseProps<Value>, 'value'> {
isDefaultable?: boolean;
onDefault?: () => void;
}
export type MultiValueButtonProps<Value extends string | number> =
| (MultiValueButtonBaseProps<Value> & PropertiesNever<MultiValueButtonDefaultableProps<Value>>)
| MultiValueButtonDefaultableProps<Value>;
2024-11-03 03:09:00 +01:00
export enum ScrollOffset {
BACKWARD,
FORWARD,
}
export enum ScrollDirection {
X,
Y,
XY,
2024-11-03 03:09:00 +01:00
}
2025-07-23 01:52:41 +02:00
export enum SearchParam {
TAB = 'tab',
QUERY = 'query',
}