feat: add rss widget (#760)
Co-authored-by: SeDemal <demal.sebastien@bluewin.ch>
This commit is contained in:
32
packages/widgets/src/rssFeed/index.ts
Normal file
32
packages/widgets/src/rssFeed/index.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { IconRss } from "@tabler/icons-react";
|
||||
|
||||
import { z } from "@homarr/validation";
|
||||
|
||||
import { createWidgetDefinition } from "../definition";
|
||||
import { optionsBuilder } from "../options";
|
||||
|
||||
/**
|
||||
* Feed must conform to one of the following standards:
|
||||
* - https://www.rssboard.org/rss-specification (https://web.resource.org/rss/1.0/spec)
|
||||
* - https://datatracker.ietf.org/doc/html/rfc5023
|
||||
* - https://www.jsonfeed.org/version/1.1/
|
||||
*/
|
||||
export const { definition, componentLoader, serverDataLoader } = createWidgetDefinition("rssFeed", {
|
||||
icon: IconRss,
|
||||
options: optionsBuilder.from((factory) => ({
|
||||
feedUrls: factory.multiText({
|
||||
defaultValue: [],
|
||||
validate: z.string().url(),
|
||||
}),
|
||||
textLinesClamp: factory.number({
|
||||
defaultValue: 5,
|
||||
validate: z.number().min(1).max(50),
|
||||
}),
|
||||
maximumAmountPosts: factory.number({
|
||||
defaultValue: 100,
|
||||
validate: z.number().min(1).max(9999),
|
||||
}),
|
||||
})),
|
||||
})
|
||||
.withServerData(() => import("./serverData"))
|
||||
.withDynamicImport(() => import("./component"));
|
||||
Reference in New Issue
Block a user