Move shlink-frontend-kit tests to its own dir

This commit is contained in:
Alejandro Celaya
2023-08-02 08:15:50 +02:00
parent 99ce8c9f74
commit b7d57a53f2
17 changed files with 43 additions and 32 deletions

View File

@@ -2,10 +2,10 @@ import type { ReactNode } from 'react';
import type { CardProps } from 'reactstrap';
import { Card, CardBody, CardHeader } from 'reactstrap';
interface SimpleCardProps extends Omit<CardProps, 'title'> {
export type SimpleCardProps = Omit<CardProps, 'title'> & {
title?: ReactNode;
bodyClassName?: string;
}
};
export const SimpleCard = ({ title, children, bodyClassName, ...rest }: SimpleCardProps) => (
<Card {...rest}>

View File

@@ -10,9 +10,9 @@ export type BooleanControlProps = PropsWithChildren<{
inline?: boolean;
}>;
interface BooleanControlWithTypeProps extends BooleanControlProps {
type BooleanControlWithTypeProps = BooleanControlProps & {
type: 'switch' | 'checkbox';
}
};
export const BooleanControl: FC<BooleanControlWithTypeProps> = (
{ checked = false, onChange = identity, className, children, type, inline = false },

View File

@@ -7,13 +7,13 @@ import './SearchField.scss';
const DEFAULT_SEARCH_INTERVAL = 500;
let timer: NodeJS.Timeout | null;
interface SearchFieldProps {
type SearchFieldProps = {
onChange: (value: string) => void;
className?: string;
large?: boolean;
noBorder?: boolean;
initialValue?: string;
}
};
export const SearchField = ({ onChange, className, large = true, noBorder = false, initialValue = '' }: SearchFieldProps) => {
const [searchTerm, setSearchTerm] = useState(initialValue);

View File

@@ -7,14 +7,14 @@ import type { Order, OrderDir } from './ordering';
import { determineOrderDir } from './ordering';
import './OrderingDropdown.scss';
export interface OrderingDropdownProps<T extends string = string> {
export type OrderingDropdownProps<T extends string = string> = {
items: Record<T, string>;
order: Order<T>;
onChange: (orderField?: T, orderDir?: OrderDir) => void;
isButton?: boolean;
right?: boolean;
prefixed?: boolean;
}
};
export function OrderingDropdown<T extends string = string>(
{ items, order, onChange, isButton = true, right = false, prefixed = true }: OrderingDropdownProps<T>,

View File

@@ -1,9 +1,9 @@
export type OrderDir = 'ASC' | 'DESC' | undefined;
export interface Order<Fields> {
export type Order<Fields> = {
field?: Fields;
dir?: OrderDir;
}
};
export const determineOrderDir = <T extends string = string>(
currentField: T,