diff --git a/docs/widgets.md b/docs/widgets.md index 38d964e0..f0ac657d 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -17,6 +17,7 @@ Dashy has support for displaying dynamic content in the form of widgets. There a - [Exchange Rates](#exchange-rates) - [Stock Price History](#stock-price-history) - [Joke of the Day](#joke) + - [News Headlines](#news-headlines) - [Flight Data](#flight-data) - [NASA APOD](#astronomy-picture-of-the-day) - [GitHub Trending](#github-trending) @@ -413,6 +414,34 @@ Renders a programming or generic joke. Data is fetched from the [JokesAPI](https --- +### News Headlines + +Displays the latest news, click to read full article. Date is fetched from various news sources using [Currents API](https://currentsapi.services/en) + +

+ +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`apiKey`** | `string` | Required | Your API key for CurrentsAPI. This is free, and you can [get one here](https://currentsapi.services/en/register) +**`country`** | `string` | _Optional_ | Fetch news only from a certain country or region. Specified as a country code, e.g. `GB` or `US`. See [here](https://api.currentsapi.services/v1/available/regions) for a list of supported regions +**`category`** | `string` | _Optional_ | Only return news from within a given category, e.g. `sports`, `programming`, `world`, `science`. The [following categories](https://api.currentsapi.services/v1/available/categories) are supported +**`lang`** | `string` | _Optional_ | Specify the language for returned articles as a 2-digit ISO code (limited article support). The [following languages](https://api.currentsapi.services/v1/available/languages) are supported, defaults to `en` +**`count`** | `number` | _Optional_ | Limit the number of results. Can be between `1` and `200`, defaults to `10` +**`keywords`** | `string` | _Optional_ | Only return articles that contain an exact match within their title or description + +##### Example + +```yaml +- type: news-headlines + options: + apiKey: xxxxxxx + category: world +``` + +--- + ### Flight Data Displays airport departure and arrival flights, using data from [AeroDataBox](https://www.aerodatabox.com/). Useful if you live near an airport and often wonder where the flight overhead is going to. Hover over a row for more flight data. diff --git a/src/components/Widgets/NewsHeadlines.vue b/src/components/Widgets/NewsHeadlines.vue new file mode 100644 index 00000000..66f1c91c --- /dev/null +++ b/src/components/Widgets/NewsHeadlines.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index 649a70b3..48da3373 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -123,6 +123,13 @@ @error="handleError" :ref="widgetRef" /> +