From 9d21fa48d017c78100a4fb9a0279b9b60449a840 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 11 Dec 2021 22:29:52 +0000 Subject: [PATCH] :sparkles: Adds XKCD comic widget --- docs/widgets.md | 20 +++++++ src/components/Widgets/WidgetBase.vue | 3 + src/components/Widgets/XkcdComic.vue | 82 +++++++++++++++++++++++++++ src/utils/defaults.js | 1 + 4 files changed, 106 insertions(+) create mode 100644 src/components/Widgets/XkcdComic.vue diff --git a/docs/widgets.md b/docs/widgets.md index 180d10a1..4ad7b798 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -140,6 +140,26 @@ Shows recent price history for a given crypto asset, using price data fetched fr numDays: 7 ``` +### XKCD Comics + +Have a laugh with the daily comic from [XKCD](https://xkcd.com/). A classic webcomic website covering everything from Linux, math, romance, science and language. + +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`comic`** | `string | number` | _Optional_ | Choose which comic to display. Set to either `random`, `latest` or the series number of a specific comic, like `627`. Defaults to `latest` + +##### Example + +```yaml +- name: XKCD of the Day + icon: fas fa-laugh + type: xkcd-comic + options: + comic: latest +``` + ### TFL Status Shows real-time tube status of the London Underground. All options are optional. diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index fe4b0a9c..d4b47836 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -16,6 +16,7 @@ + @@ -27,6 +28,7 @@ import WeatherForecast from '@/components/Widgets/WeatherForecast.vue'; import TflStatus from '@/components/Widgets/TflStatus.vue'; import CryptoPriceChart from '@/components/Widgets/CryptoPriceChart.vue'; import CryptoWatchList from '@/components/Widgets/CryptoWatchList.vue'; +import XkcdComic from '@/components/Widgets/XkcdComic.vue'; import Collapsable from '@/components/LinkItems/Collapsable.vue'; export default { @@ -39,6 +41,7 @@ export default { TflStatus, CryptoPriceChart, CryptoWatchList, + XkcdComic, }, props: { widget: Object, diff --git a/src/components/Widgets/XkcdComic.vue b/src/components/Widgets/XkcdComic.vue new file mode 100644 index 00000000..99af5e59 --- /dev/null +++ b/src/components/Widgets/XkcdComic.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/utils/defaults.js b/src/utils/defaults.js index cbc567d2..9e07e316 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -210,6 +210,7 @@ module.exports = { tflStatus: 'https://api.tfl.gov.uk/line/mode/tube/status', cryptoPrices: 'https://api.coingecko.com/api/v3/coins/', cryptoWatchList: 'https://api.coingecko.com/api/v3/coins/markets/', + xkcdComic: 'https://xkcd.vercel.app/', }, /* URLs for web search engines */ searchEngineUrls: {