mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
✨ add a <Tip/> component and use it
This commit is contained in:
@@ -24,6 +24,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import { useDebouncedValue } from '@mantine/hooks';
|
||||
import { useConfig } from '../../tools/state';
|
||||
import { ServiceTypeList, StatusCodes } from '../../tools/types';
|
||||
import Tip from '../layout/Tip';
|
||||
|
||||
export function AddItemShelfButton(props: any) {
|
||||
const [opened, setOpened] = useState(false);
|
||||
@@ -273,15 +274,8 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
||||
}}
|
||||
error={form.errors.apiKey && 'Invalid API key'}
|
||||
/>
|
||||
<Text
|
||||
style={{
|
||||
alignSelf: 'center',
|
||||
fontSize: '0.75rem',
|
||||
textAlign: 'center',
|
||||
color: 'gray',
|
||||
}}
|
||||
>
|
||||
Tip: Get your API key{' '}
|
||||
<Tip>
|
||||
Get your API key{' '}
|
||||
<Anchor
|
||||
target="_blank"
|
||||
weight="bold"
|
||||
@@ -290,7 +284,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
||||
>
|
||||
here.
|
||||
</Anchor>
|
||||
</Text>
|
||||
</Tip>
|
||||
</>
|
||||
)}
|
||||
{form.values.type === 'qBittorrent' && (
|
||||
|
||||
@@ -6,6 +6,7 @@ import { WidgetsPositionSwitch } from '../WidgetsPositionSwitch/WidgetsPositionS
|
||||
import ConfigChanger from '../Config/ConfigChanger';
|
||||
import SaveConfigComponent from '../Config/SaveConfig';
|
||||
import ModuleEnabler from './ModuleEnabler';
|
||||
import Tip from '../layout/Tip';
|
||||
|
||||
export default function CommonSettings(args: any) {
|
||||
const { config, setConfig } = useConfig();
|
||||
@@ -26,17 +27,13 @@ export default function CommonSettings(args: any) {
|
||||
<Group direction="column" grow mb="lg">
|
||||
<Group grow direction="column" spacing={0}>
|
||||
<Text>Search engine</Text>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: '0.75rem',
|
||||
color: 'gray',
|
||||
marginBottom: '0.5rem',
|
||||
}}
|
||||
>
|
||||
Tip: %s can be used as a placeholder for the query.
|
||||
</Text>
|
||||
<Tip>
|
||||
Use the prefixes <b>!yt</b> and <b>!t</b> in front of your query to search on YouTube or
|
||||
for a Torrent respectively.
|
||||
</Tip>
|
||||
<SegmentedControl
|
||||
fullWidth
|
||||
mb="sm"
|
||||
title="Search engine"
|
||||
value={
|
||||
// Match config.settings.searchUrl with a key in the matches array
|
||||
@@ -58,6 +55,8 @@ export default function CommonSettings(args: any) {
|
||||
data={matches}
|
||||
/>
|
||||
{searchUrl === 'Custom' && (
|
||||
<>
|
||||
<Tip>%s can be used as a placeholder for the query.</Tip>
|
||||
<TextInput
|
||||
label="Query URL"
|
||||
placeholder="Custom query URL"
|
||||
@@ -73,6 +72,7 @@ export default function CommonSettings(args: any) {
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Group>
|
||||
<ColorSchemeSwitch />
|
||||
@@ -80,16 +80,7 @@ export default function CommonSettings(args: any) {
|
||||
<ModuleEnabler />
|
||||
<ConfigChanger />
|
||||
<SaveConfigComponent />
|
||||
<Text
|
||||
style={{
|
||||
alignSelf: 'center',
|
||||
fontSize: '0.75rem',
|
||||
textAlign: 'center',
|
||||
color: 'gray',
|
||||
}}
|
||||
>
|
||||
Tip: You can upload your config file by dragging and dropping it onto the page!
|
||||
</Text>
|
||||
<Tip>Upload your config file by dragging and dropping it onto the page!</Tip>
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
|
||||
19
src/components/layout/Tip.tsx
Normal file
19
src/components/layout/Tip.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Text } from '@mantine/core';
|
||||
|
||||
interface TipProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function Tip(props: TipProps) {
|
||||
return (
|
||||
<Text
|
||||
style={{
|
||||
fontSize: '0.75rem',
|
||||
color: 'gray',
|
||||
marginBottom: '0.5rem',
|
||||
}}
|
||||
>
|
||||
Tip: {props.children}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user