feat: RTL option to RSS widget (#1247)
This commit is contained in:
@@ -4,6 +4,7 @@ export type OldmarrRssDefinition = CommonOldmarrWidgetDefinition<
|
|||||||
"rss",
|
"rss",
|
||||||
{
|
{
|
||||||
rssFeedUrl: string[];
|
rssFeedUrl: string[];
|
||||||
|
enableRtl: boolean;
|
||||||
refreshInterval: number;
|
refreshInterval: number;
|
||||||
dangerousAllowSanitizedItemContent: boolean;
|
dangerousAllowSanitizedItemContent: boolean;
|
||||||
textLinesClamp: number;
|
textLinesClamp: number;
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ const optionMapping: OptionMapping = {
|
|||||||
},
|
},
|
||||||
rssFeed: {
|
rssFeed: {
|
||||||
feedUrls: (oldOptions) => oldOptions.rssFeedUrl,
|
feedUrls: (oldOptions) => oldOptions.rssFeedUrl,
|
||||||
|
enableRtl: (oldOptions) => oldOptions.enableRtl,
|
||||||
maximumAmountPosts: (oldOptions) => oldOptions.maximumAmountOfPosts,
|
maximumAmountPosts: (oldOptions) => oldOptions.maximumAmountOfPosts,
|
||||||
textLinesClamp: (oldOptions) => oldOptions.textLinesClamp,
|
textLinesClamp: (oldOptions) => oldOptions.textLinesClamp,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1351,6 +1351,9 @@ export default {
|
|||||||
feedUrls: {
|
feedUrls: {
|
||||||
label: "Feed URLs",
|
label: "Feed URLs",
|
||||||
},
|
},
|
||||||
|
enableRtl: {
|
||||||
|
label: "Enable RTL",
|
||||||
|
},
|
||||||
textLinesClamp: {
|
textLinesClamp: {
|
||||||
label: "Description line clamp",
|
label: "Description line clamp",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import React from "react";
|
|
||||||
import { Card, Flex, Group, Image, ScrollArea, Stack, Text } from "@mantine/core";
|
import { Card, Flex, Group, Image, ScrollArea, Stack, Text } from "@mantine/core";
|
||||||
import { IconClock } from "@tabler/icons-react";
|
import { IconClock } from "@tabler/icons-react";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
@@ -37,6 +36,8 @@ export default function RssFeed({ options, itemId }: WidgetComponentProps<"rssFe
|
|||||||
})
|
})
|
||||||
.slice(0, options.maximumAmountPosts as number);
|
.slice(0, options.maximumAmountPosts as number);
|
||||||
|
|
||||||
|
const languageDir = options.enableRtl ? "RTL" : "LTR";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollArea className="scroll-area-w100" w="100%" p="4cqmin">
|
<ScrollArea className="scroll-area-w100" w="100%" p="4cqmin">
|
||||||
<Stack w={"100%"} gap="4cqmin">
|
<Stack w={"100%"} gap="4cqmin">
|
||||||
@@ -56,12 +57,13 @@ export default function RssFeed({ options, itemId }: WidgetComponentProps<"rssFe
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<Flex gap="2.5cqmin" direction="column" w="100%">
|
<Flex gap="2.5cqmin" direction="column" w="100%">
|
||||||
<Text fz="4cqmin" lh="5cqmin" lineClamp={2}>
|
<Text dir={languageDir} fz="4cqmin" lh="5cqmin" lineClamp={2}>
|
||||||
{feedEntry.title}
|
{feedEntry.title}
|
||||||
</Text>
|
</Text>
|
||||||
{feedEntry.description && (
|
{feedEntry.description && (
|
||||||
<Text
|
<Text
|
||||||
className={feedEntry.description}
|
className={feedEntry.description}
|
||||||
|
dir={languageDir}
|
||||||
c="dimmed"
|
c="dimmed"
|
||||||
size="3.5cqmin"
|
size="3.5cqmin"
|
||||||
lineClamp={options.textLinesClamp as number}
|
lineClamp={options.textLinesClamp as number}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ export const { definition, componentLoader } = createWidgetDefinition("rssFeed",
|
|||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
validate: z.string().url(),
|
validate: z.string().url(),
|
||||||
}),
|
}),
|
||||||
|
enableRtl: factory.switch({
|
||||||
|
defaultValue: false,
|
||||||
|
}),
|
||||||
textLinesClamp: factory.number({
|
textLinesClamp: factory.number({
|
||||||
defaultValue: 5,
|
defaultValue: 5,
|
||||||
validate: z.number().min(1).max(50),
|
validate: z.number().min(1).max(50),
|
||||||
|
|||||||
Reference in New Issue
Block a user