mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
* fix interface names * use Readonly for props * fix typescript:S3863 * require hashes in package installer too
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Anchor, Group, Stack, Text, Title } from '@mantine/core';
|
|
import { IconSwitch } from '@tabler/icons-react';
|
|
import { ReactNode } from 'react';
|
|
import { Link } from 'react-router-dom';
|
|
|
|
interface SettingsHeaderInterface {
|
|
title: string | ReactNode;
|
|
shorthand?: string;
|
|
subtitle?: string | ReactNode;
|
|
switch_condition?: boolean;
|
|
switch_text?: string | ReactNode;
|
|
switch_link?: string;
|
|
}
|
|
|
|
/**
|
|
* Construct a settings page header with interlinks to one other settings page
|
|
*/
|
|
export function SettingsHeader({
|
|
title,
|
|
shorthand,
|
|
subtitle,
|
|
switch_condition = true,
|
|
switch_text,
|
|
switch_link
|
|
}: Readonly<SettingsHeaderInterface>) {
|
|
return (
|
|
<Stack spacing="0" ml={'sm'}>
|
|
<Group>
|
|
<Title order={3}>{title}</Title>
|
|
{shorthand && <Text c="dimmed">({shorthand})</Text>}
|
|
</Group>
|
|
<Group>
|
|
<Text c="dimmed">{subtitle}</Text>
|
|
{switch_text && switch_link && switch_condition && (
|
|
<Anchor component={Link} to={switch_link}>
|
|
<IconSwitch size={14} />
|
|
{switch_text}
|
|
</Anchor>
|
|
)}
|
|
</Group>
|
|
</Stack>
|
|
);
|
|
}
|