dineway 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/{apply-CAPvMfoU.mjs → apply-iVSqz2qs.mjs} +132 -39
- package/dist/astro/index.d.mts +18 -9
- package/dist/astro/index.mjs +238 -16
- package/dist/astro/middleware/auth.d.mts +16 -5
- package/dist/astro/middleware/auth.mjs +74 -37
- package/dist/astro/middleware/redirect.mjs +24 -8
- package/dist/astro/middleware/request-context.mjs +18 -5
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +411 -169
- package/dist/astro/types.d.mts +25 -8
- package/dist/{byline-DeWCMU_i.mjs → byline-OhH2dlRu.mjs} +6 -21
- package/dist/{bylines-DyqBV9EQ.mjs → bylines-BGpD9_hy.mjs} +16 -6
- package/dist/cache-BdSY-gQN.mjs +42 -0
- package/dist/chunks--4F8ddV4.mjs +18 -0
- package/dist/cli/index.mjs +935 -15
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +11 -3
- package/dist/client/index.mjs +4 -3
- package/dist/{connection-C9pxzuag.mjs → connection-BCNICDWN.mjs} +22 -5
- package/dist/{content-zSgdNmnt.mjs → content-DWi4d0rT.mjs} +41 -2
- package/dist/database/instrumentation.d.mts +34 -0
- package/dist/database/instrumentation.mjs +53 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +2 -2
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.mjs +11 -5
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +7 -1
- package/dist/db-errors-CEqD7qH9.mjs +23 -0
- package/dist/{default-WYlzADZL.mjs → default-VjJyuuG9.mjs} +2 -0
- package/dist/{dialect-helpers-B9uSp2GJ.mjs → dialect-helpers-DhTzaUxP.mjs} +3 -0
- package/dist/{error-DrxtnGPg.mjs → error-BmL6QipT.mjs} +7 -3
- package/dist/{index-C-jx21qs.d.mts → index-yvc6E_17.d.mts} +157 -30
- package/dist/index.d.mts +11 -11
- package/dist/index.mjs +24 -22
- package/dist/{loader-qKmo0wAY.mjs → loader-sMG4TZ-u.mjs} +9 -3
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +1 -1
- package/dist/media/local-runtime.d.mts +7 -7
- package/dist/page/index.d.mts +10 -2
- package/dist/page/index.mjs +22 -1
- package/dist/patterns-CrCYkMBb.mjs +92 -0
- package/dist/{placeholder-bOx1xCTY.d.mts → placeholder--wOi4TbO.d.mts} +1 -1
- package/dist/{placeholder-B3knXwNc.mjs → placeholder-Cp8g5Emj.mjs} +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{query-BiaPl_g2.mjs → query-kDmwCsHh.mjs} +118 -50
- package/dist/{redirect-JPqLAbxa.mjs → redirect-DnEWAkVg.mjs} +43 -99
- package/dist/{registry-DSd1GWB8.mjs → registry-C0zjeB9P.mjs} +191 -123
- package/dist/request-cache-Dk5qPSOx.mjs +66 -0
- package/dist/request-context.d.mts +4 -16
- package/dist/{runner-B5l1JfOj.d.mts → runner-CFI6B6J2.d.mts} +1 -1
- package/dist/{runner-BGUGywgG.mjs → runner-DWZm2KQm.mjs} +589 -137
- package/dist/runtime.d.mts +6 -6
- package/dist/runtime.mjs +2 -2
- package/dist/{search-BNruJHDL.mjs → search-ByRGV2pq.mjs} +570 -424
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +11 -10
- package/dist/seo/index.d.mts +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +11 -3
- package/dist/storage/s3.mjs +78 -15
- package/dist/taxonomies-1s5PaS_8.mjs +266 -0
- package/dist/transaction-Cn2rjY78.mjs +27 -0
- package/dist/{types-BgQeVaPj.d.mts → types-BuMDPy5C.d.mts} +52 -3
- package/dist/{types-DuNbGKjF.mjs → types-COeOq9nK.mjs} +6 -1
- package/dist/{types-ju-_ORz7.d.mts → types-CWbdtiux.d.mts} +13 -5
- package/dist/{types-D38djUXv.d.mts → types-Cj0KMIZV.d.mts} +16 -3
- package/dist/{types-DkvMXalq.d.mts → types-DOrVigru.d.mts} +159 -0
- package/dist/{validate-CXnRKfJK.mjs → validate-BZ5wnLLp.mjs} +2 -1
- package/dist/{validate-DVKJJ-M_.d.mts → validate-IPf8n4Fj.d.mts} +4 -51
- package/dist/{validate-CqRJb_xU.mjs → validate-VPnKoIzW.mjs} +10 -10
- package/dist/version-BKXPsfmJ.mjs +6 -0
- package/package.json +53 -39
- package/src/astro/routes/PluginRegistry.tsx +21 -0
- package/src/astro/routes/admin.astro +99 -0
- package/src/astro/routes/api/admin/allowed-domains/[domain].ts +112 -0
- package/src/astro/routes/api/admin/allowed-domains/index.ts +108 -0
- package/src/astro/routes/api/admin/api-tokens/[id].ts +44 -0
- package/src/astro/routes/api/admin/api-tokens/index.ts +90 -0
- package/src/astro/routes/api/admin/briefing.ts +76 -0
- package/src/astro/routes/api/admin/bylines/[id]/index.ts +90 -0
- package/src/astro/routes/api/admin/bylines/index.ts +74 -0
- package/src/astro/routes/api/admin/comments/[id]/status.ts +120 -0
- package/src/astro/routes/api/admin/comments/[id].ts +64 -0
- package/src/astro/routes/api/admin/comments/bulk.ts +42 -0
- package/src/astro/routes/api/admin/comments/counts.ts +30 -0
- package/src/astro/routes/api/admin/comments/index.ts +46 -0
- package/src/astro/routes/api/admin/context/[id]/history.ts +35 -0
- package/src/astro/routes/api/admin/context/[id]/index.ts +35 -0
- package/src/astro/routes/api/admin/context/[id]/review.ts +57 -0
- package/src/astro/routes/api/admin/context/[id]/supersede.ts +58 -0
- package/src/astro/routes/api/admin/context/diff.ts +35 -0
- package/src/astro/routes/api/admin/context/index.ts +69 -0
- package/src/astro/routes/api/admin/context/stale.ts +35 -0
- package/src/astro/routes/api/admin/hitl-requests/[id]/index.ts +38 -0
- package/src/astro/routes/api/admin/hitl-requests/[id]/resolve.ts +54 -0
- package/src/astro/routes/api/admin/hitl-requests/index.ts +38 -0
- package/src/astro/routes/api/admin/hooks/exclusive/[hookName].ts +132 -0
- package/src/astro/routes/api/admin/hooks/exclusive/index.ts +51 -0
- package/src/astro/routes/api/admin/oauth-clients/[id].ts +137 -0
- package/src/astro/routes/api/admin/oauth-clients/index.ts +95 -0
- package/src/astro/routes/api/admin/plugins/[id]/disable.ts +91 -0
- package/src/astro/routes/api/admin/plugins/[id]/enable.ts +91 -0
- package/src/astro/routes/api/admin/plugins/[id]/index.ts +38 -0
- package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +98 -0
- package/src/astro/routes/api/admin/plugins/[id]/update.ts +154 -0
- package/src/astro/routes/api/admin/plugins/index.ts +32 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +62 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/index.ts +33 -0
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +135 -0
- package/src/astro/routes/api/admin/plugins/marketplace/index.ts +38 -0
- package/src/astro/routes/api/admin/plugins/updates.ts +28 -0
- package/src/astro/routes/api/admin/review-requests/[id]/index.ts +35 -0
- package/src/astro/routes/api/admin/review-requests/[id]/resolve.ts +52 -0
- package/src/astro/routes/api/admin/review-requests/index.ts +35 -0
- package/src/astro/routes/api/admin/themes/marketplace/[id]/index.ts +33 -0
- package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +62 -0
- package/src/astro/routes/api/admin/themes/marketplace/index.ts +45 -0
- package/src/astro/routes/api/admin/users/[id]/disable.ts +72 -0
- package/src/astro/routes/api/admin/users/[id]/enable.ts +48 -0
- package/src/astro/routes/api/admin/users/[id]/index.ts +166 -0
- package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +72 -0
- package/src/astro/routes/api/admin/users/index.ts +66 -0
- package/src/astro/routes/api/auth/dev-bypass.ts +139 -0
- package/src/astro/routes/api/auth/invite/accept.ts +52 -0
- package/src/astro/routes/api/auth/invite/complete.ts +86 -0
- package/src/astro/routes/api/auth/invite/index.ts +99 -0
- package/src/astro/routes/api/auth/invite/register-options.ts +73 -0
- package/src/astro/routes/api/auth/logout.ts +40 -0
- package/src/astro/routes/api/auth/magic-link/send.ts +90 -0
- package/src/astro/routes/api/auth/magic-link/verify.ts +71 -0
- package/src/astro/routes/api/auth/me.ts +60 -0
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +221 -0
- package/src/astro/routes/api/auth/oauth/[provider].ts +120 -0
- package/src/astro/routes/api/auth/passkey/[id].ts +124 -0
- package/src/astro/routes/api/auth/passkey/index.ts +54 -0
- package/src/astro/routes/api/auth/passkey/options.ts +85 -0
- package/src/astro/routes/api/auth/passkey/register/options.ts +88 -0
- package/src/astro/routes/api/auth/passkey/register/verify.ts +119 -0
- package/src/astro/routes/api/auth/passkey/verify.ts +72 -0
- package/src/astro/routes/api/auth/signup/complete.ts +87 -0
- package/src/astro/routes/api/auth/signup/request.ts +89 -0
- package/src/astro/routes/api/auth/signup/verify.ts +53 -0
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +310 -0
- package/src/astro/routes/api/content/[collection]/[id]/compare.ts +28 -0
- package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +68 -0
- package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +77 -0
- package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +42 -0
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +107 -0
- package/src/astro/routes/api/content/[collection]/[id]/publish.ts +100 -0
- package/src/astro/routes/api/content/[collection]/[id]/restore.ts +64 -0
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +31 -0
- package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +129 -0
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +143 -0
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +50 -0
- package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +69 -0
- package/src/astro/routes/api/content/[collection]/[id].ts +173 -0
- package/src/astro/routes/api/content/[collection]/index.ts +103 -0
- package/src/astro/routes/api/content/[collection]/trash.ts +33 -0
- package/src/astro/routes/api/dashboard.ts +32 -0
- package/src/astro/routes/api/dev/emails.ts +36 -0
- package/src/astro/routes/api/health.ts +54 -0
- package/src/astro/routes/api/import/probe.ts +47 -0
- package/src/astro/routes/api/import/wordpress/analyze.ts +523 -0
- package/src/astro/routes/api/import/wordpress/execute.ts +330 -0
- package/src/astro/routes/api/import/wordpress/media.ts +338 -0
- package/src/astro/routes/api/import/wordpress/prepare.ts +212 -0
- package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +425 -0
- package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +111 -0
- package/src/astro/routes/api/import/wordpress-plugin/callback.ts +58 -0
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +399 -0
- package/src/astro/routes/api/manifest.ts +75 -0
- package/src/astro/routes/api/mcp.ts +125 -0
- package/src/astro/routes/api/media/[id]/confirm.ts +93 -0
- package/src/astro/routes/api/media/[id].ts +145 -0
- package/src/astro/routes/api/media/file/[...key].ts +79 -0
- package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +91 -0
- package/src/astro/routes/api/media/providers/[providerId]/index.ts +111 -0
- package/src/astro/routes/api/media/providers/index.ts +30 -0
- package/src/astro/routes/api/media/upload-url.ts +146 -0
- package/src/astro/routes/api/media.ts +204 -0
- package/src/astro/routes/api/menus/[name]/items.ts +206 -0
- package/src/astro/routes/api/menus/[name]/reorder.ts +79 -0
- package/src/astro/routes/api/menus/[name].ts +145 -0
- package/src/astro/routes/api/menus/index.ts +91 -0
- package/src/astro/routes/api/oauth/authorize.ts +430 -0
- package/src/astro/routes/api/oauth/device/authorize.ts +45 -0
- package/src/astro/routes/api/oauth/device/code.ts +56 -0
- package/src/astro/routes/api/oauth/device/token.ts +70 -0
- package/src/astro/routes/api/oauth/register.ts +182 -0
- package/src/astro/routes/api/oauth/token/refresh.ts +38 -0
- package/src/astro/routes/api/oauth/token/revoke.ts +38 -0
- package/src/astro/routes/api/oauth/token.ts +195 -0
- package/src/astro/routes/api/openapi.json.ts +33 -0
- package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +109 -0
- package/src/astro/routes/api/redirects/404s/index.ts +72 -0
- package/src/astro/routes/api/redirects/404s/summary.ts +33 -0
- package/src/astro/routes/api/redirects/[id].ts +183 -0
- package/src/astro/routes/api/redirects/index.ts +100 -0
- package/src/astro/routes/api/revisions/[revisionId]/index.ts +29 -0
- package/src/astro/routes/api/revisions/[revisionId]/restore.ts +62 -0
- package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +104 -0
- package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +67 -0
- package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +45 -0
- package/src/astro/routes/api/schema/collections/[slug]/index.ts +107 -0
- package/src/astro/routes/api/schema/collections/index.ts +61 -0
- package/src/astro/routes/api/schema/index.ts +109 -0
- package/src/astro/routes/api/schema/orphans/[slug].ts +36 -0
- package/src/astro/routes/api/schema/orphans/index.ts +26 -0
- package/src/astro/routes/api/search/enable.ts +64 -0
- package/src/astro/routes/api/search/index.ts +52 -0
- package/src/astro/routes/api/search/rebuild.ts +72 -0
- package/src/astro/routes/api/search/stats.ts +35 -0
- package/src/astro/routes/api/search/suggest.ts +50 -0
- package/src/astro/routes/api/sections/[slug].ts +203 -0
- package/src/astro/routes/api/sections/index.ts +107 -0
- package/src/astro/routes/api/settings/email.ts +150 -0
- package/src/astro/routes/api/settings.ts +116 -0
- package/src/astro/routes/api/setup/admin-verify.ts +122 -0
- package/src/astro/routes/api/setup/admin.ts +104 -0
- package/src/astro/routes/api/setup/dev-bypass.ts +200 -0
- package/src/astro/routes/api/setup/dev-reset.ts +40 -0
- package/src/astro/routes/api/setup/index.ts +128 -0
- package/src/astro/routes/api/setup/status.ts +122 -0
- package/src/astro/routes/api/snapshot.ts +76 -0
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +232 -0
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +131 -0
- package/src/astro/routes/api/taxonomies/index.ts +114 -0
- package/src/astro/routes/api/themes/preview.ts +78 -0
- package/src/astro/routes/api/typegen.ts +114 -0
- package/src/astro/routes/api/well-known/auth.ts +71 -0
- package/src/astro/routes/api/well-known/oauth-authorization-server.ts +48 -0
- package/src/astro/routes/api/well-known/oauth-protected-resource.ts +39 -0
- package/src/astro/routes/api/widget-areas/[name]/reorder.ts +114 -0
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +213 -0
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +126 -0
- package/src/astro/routes/api/widget-areas/[name].ts +135 -0
- package/src/astro/routes/api/widget-areas/index.ts +149 -0
- package/src/astro/routes/api/widget-components.ts +22 -0
- package/src/astro/routes/robots.txt.ts +81 -0
- package/src/astro/routes/sitemap-[collection].xml.ts +104 -0
- package/src/astro/routes/sitemap.xml.ts +92 -0
- package/src/components/Break.astro +45 -0
- package/src/components/Button.astro +71 -0
- package/src/components/Buttons.astro +49 -0
- package/src/components/Code.astro +59 -0
- package/src/components/Columns.astro +59 -0
- package/src/components/CommentForm.astro +315 -0
- package/src/components/Comments.astro +232 -0
- package/src/components/Cover.astro +128 -0
- package/src/components/DinewayBodyEnd.astro +32 -0
- package/src/components/DinewayBodyStart.astro +32 -0
- package/src/components/DinewayHead.astro +61 -0
- package/src/components/DinewayImage.astro +178 -0
- package/src/components/DinewayMedia.astro +167 -0
- package/src/components/Embed.astro +128 -0
- package/src/components/File.astro +122 -0
- package/src/components/Gallery.astro +93 -0
- package/src/components/HtmlBlock.astro +33 -0
- package/src/components/Image.astro +178 -0
- package/src/components/InlineEditor.astro +27 -0
- package/src/components/InlinePortableTextEditor.tsx +1937 -0
- package/src/components/LiveSearch.astro +614 -0
- package/src/components/PortableText.astro +51 -0
- package/src/components/Pullquote.astro +51 -0
- package/src/components/Table.astro +135 -0
- package/src/components/WidgetArea.astro +22 -0
- package/src/components/WidgetRenderer.astro +72 -0
- package/src/components/index.ts +106 -0
- package/src/components/marks/Link.astro +31 -0
- package/src/components/marks/StrikeThrough.astro +7 -0
- package/src/components/marks/Subscript.astro +7 -0
- package/src/components/marks/Superscript.astro +7 -0
- package/src/components/marks/Underline.astro +7 -0
- package/src/components/marks.ts +19 -0
- package/src/components/widgets/Archives.astro +65 -0
- package/src/components/widgets/Categories.astro +35 -0
- package/src/components/widgets/RecentPosts.astro +51 -0
- package/src/components/widgets/Search.astro +18 -0
- package/src/components/widgets/Tags.astro +38 -0
- package/src/ui.ts +75 -0
- package/LICENSE +0 -9
- /package/dist/{adapters-BlzWJG82.d.mts → adapters-C2ypTrZZ.d.mts} +0 -0
- /package/dist/{config-Cq8H0SfX.mjs → config-BXwuX8Bx.mjs} +0 -0
- /package/dist/{load-C6FCD1FU.mjs → load-Coc9HpHH.mjs} +0 -0
- /package/dist/{manifest-schema-CTSEyIJ3.mjs → manifest-schema-D1MSVnoI.mjs} +0 -0
- /package/dist/{mode-BlyYtIFO.mjs → mode-47goXBBK.mjs} +0 -0
- /package/dist/{tokens-4vgYuXsZ.mjs → tokens-CJz9ubV6.mjs} +0 -0
- /package/dist/{transport-C5FYnid7.mjs → transport-DB5eDN4x.mjs} +0 -0
- /package/dist/{transport-gIL-e43D.d.mts → transport-Wge_IzKl.d.mts} +0 -0
- /package/dist/{types-CLLdsG3g.d.mts → types-BzcUjoqg.d.mts} +0 -0
- /package/dist/{types-DShnjzb6.mjs → types-griIBQOQ.mjs} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Portable Text Table block component
|
|
4
|
+
*
|
|
5
|
+
* Renders tables from content imports. Cell content is rendered through the
|
|
6
|
+
* standard Portable Text pipeline so all marks, including links, are handled
|
|
7
|
+
* by the registered mark components.
|
|
8
|
+
*/
|
|
9
|
+
import { PortableText } from "astro-portabletext";
|
|
10
|
+
import { dinewayMarkComponents } from "./marks.js";
|
|
11
|
+
|
|
12
|
+
export interface Props {
|
|
13
|
+
node: {
|
|
14
|
+
_type: "table";
|
|
15
|
+
_key: string;
|
|
16
|
+
rows: Array<{
|
|
17
|
+
_type: "tableRow";
|
|
18
|
+
_key: string;
|
|
19
|
+
cells: Array<{
|
|
20
|
+
_type: "tableCell";
|
|
21
|
+
_key: string;
|
|
22
|
+
content: Array<{
|
|
23
|
+
_type: "span";
|
|
24
|
+
_key: string;
|
|
25
|
+
text: string;
|
|
26
|
+
marks?: string[];
|
|
27
|
+
}>;
|
|
28
|
+
markDefs?: Array<{
|
|
29
|
+
_type: string;
|
|
30
|
+
_key: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}>;
|
|
33
|
+
isHeader?: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
hasHeaderRow?: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const markComponents = { mark: dinewayMarkComponents };
|
|
41
|
+
|
|
42
|
+
const { node } = Astro.props;
|
|
43
|
+
const rows = node?.rows ?? [];
|
|
44
|
+
|
|
45
|
+
if (!rows.length) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function cellToBlock(cell: Props["node"]["rows"][number]["cells"][number]) {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
_type: "block" as const,
|
|
53
|
+
_key: cell._key,
|
|
54
|
+
children: cell.content,
|
|
55
|
+
markDefs: cell.markDefs ?? [],
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const hasHeader = node?.hasHeaderRow;
|
|
61
|
+
const headerRow = hasHeader ? rows[0] : null;
|
|
62
|
+
const bodyRows = hasHeader ? rows.slice(1) : rows;
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
<div class="dineway-table-wrapper">
|
|
66
|
+
<table class="dineway-table">
|
|
67
|
+
{
|
|
68
|
+
headerRow && (
|
|
69
|
+
<thead>
|
|
70
|
+
<tr>
|
|
71
|
+
{headerRow.cells.map((cell) => (
|
|
72
|
+
<th>
|
|
73
|
+
<PortableText
|
|
74
|
+
value={cellToBlock(cell)}
|
|
75
|
+
components={markComponents}
|
|
76
|
+
/>
|
|
77
|
+
</th>
|
|
78
|
+
))}
|
|
79
|
+
</tr>
|
|
80
|
+
</thead>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
<tbody>
|
|
84
|
+
{
|
|
85
|
+
bodyRows.map((row) => (
|
|
86
|
+
<tr>
|
|
87
|
+
{row.cells.map((cell) => {
|
|
88
|
+
const CellTag = cell.isHeader ? "th" : "td";
|
|
89
|
+
return (
|
|
90
|
+
<CellTag>
|
|
91
|
+
<PortableText
|
|
92
|
+
value={cellToBlock(cell)}
|
|
93
|
+
components={markComponents}
|
|
94
|
+
/>
|
|
95
|
+
</CellTag>
|
|
96
|
+
);
|
|
97
|
+
})}
|
|
98
|
+
</tr>
|
|
99
|
+
))
|
|
100
|
+
}
|
|
101
|
+
</tbody>
|
|
102
|
+
</table>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<style>
|
|
106
|
+
.dineway-table-wrapper {
|
|
107
|
+
margin: 1.5rem 0;
|
|
108
|
+
overflow-x: auto;
|
|
109
|
+
}
|
|
110
|
+
.dineway-table {
|
|
111
|
+
width: 100%;
|
|
112
|
+
border-collapse: collapse;
|
|
113
|
+
font-size: 0.9rem;
|
|
114
|
+
}
|
|
115
|
+
.dineway-table th,
|
|
116
|
+
.dineway-table td {
|
|
117
|
+
border: 1px solid var(--color-border, #ddd);
|
|
118
|
+
padding: 0.75rem;
|
|
119
|
+
text-align: left;
|
|
120
|
+
}
|
|
121
|
+
.dineway-table th :global(p),
|
|
122
|
+
.dineway-table td :global(p) {
|
|
123
|
+
margin: 0;
|
|
124
|
+
}
|
|
125
|
+
.dineway-table th {
|
|
126
|
+
background: var(--color-surface, #f5f5f5);
|
|
127
|
+
font-weight: 600;
|
|
128
|
+
}
|
|
129
|
+
.dineway-table tbody tr:nth-child(even) {
|
|
130
|
+
background: var(--color-bg-subtle, #fafafa);
|
|
131
|
+
}
|
|
132
|
+
.dineway-table tbody tr:hover {
|
|
133
|
+
background: var(--color-surface, #f0f0f0);
|
|
134
|
+
}
|
|
135
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getWidgetArea } from "../widgets/index.js";
|
|
3
|
+
import WidgetRenderer from "./WidgetRenderer.astro";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
name: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { name, class: className } = Astro.props;
|
|
11
|
+
const area = await getWidgetArea(name);
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
{
|
|
15
|
+
area && area.widgets.length > 0 && (
|
|
16
|
+
<div class:list={["widget-area", className]} data-widget-area={name}>
|
|
17
|
+
{area.widgets.map((widget) => (
|
|
18
|
+
<WidgetRenderer widget={widget} />
|
|
19
|
+
))}
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { Widget } from "../widgets/types.js";
|
|
3
|
+
import { getMenu } from "../menus/index.js";
|
|
4
|
+
import { sanitizeHref } from "../utils/url.js";
|
|
5
|
+
import PortableText from "./PortableText.astro";
|
|
6
|
+
import RecentPosts from "./widgets/RecentPosts.astro";
|
|
7
|
+
import Categories from "./widgets/Categories.astro";
|
|
8
|
+
import Tags from "./widgets/Tags.astro";
|
|
9
|
+
import Search from "./widgets/Search.astro";
|
|
10
|
+
import Archives from "./widgets/Archives.astro";
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
widget: Widget;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { widget } = Astro.props;
|
|
17
|
+
|
|
18
|
+
// Component map for core widgets
|
|
19
|
+
const componentMap = {
|
|
20
|
+
"core:recent-posts": RecentPosts,
|
|
21
|
+
"core:categories": Categories,
|
|
22
|
+
"core:tags": Tags,
|
|
23
|
+
"core:search": Search,
|
|
24
|
+
"core:archives": Archives,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// For menu widgets, get menu data
|
|
28
|
+
let menuData = null;
|
|
29
|
+
if (widget.type === "menu" && widget.menuName) {
|
|
30
|
+
menuData = await getMenu(widget.menuName);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// For component widgets, get the component
|
|
34
|
+
let WidgetComponent = null;
|
|
35
|
+
if (widget.type === "component" && widget.componentId) {
|
|
36
|
+
WidgetComponent = componentMap[widget.componentId as keyof typeof componentMap];
|
|
37
|
+
}
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
<div class="widget" data-widget-id={widget.id} data-widget-type={widget.type}>
|
|
41
|
+
{widget.title && <h3 class="widget__title">{widget.title}</h3>}
|
|
42
|
+
|
|
43
|
+
<div class="widget__content">
|
|
44
|
+
{
|
|
45
|
+
widget.type === "content" && widget.content && (
|
|
46
|
+
<PortableText value={widget.content} />
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
{
|
|
51
|
+
widget.type === "menu" && menuData && (
|
|
52
|
+
<nav class="widget__menu">
|
|
53
|
+
<ul>
|
|
54
|
+
{menuData.items.map((item) => (
|
|
55
|
+
<li>
|
|
56
|
+
<a href={sanitizeHref(item.url)} title={item.titleAttr || undefined}>
|
|
57
|
+
{item.label}
|
|
58
|
+
</a>
|
|
59
|
+
</li>
|
|
60
|
+
))}
|
|
61
|
+
</ul>
|
|
62
|
+
</nav>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
{
|
|
67
|
+
widget.type === "component" && WidgetComponent && (
|
|
68
|
+
<WidgetComponent {...(widget.componentProps || {})} />
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dineway Portable Text Components
|
|
3
|
+
*
|
|
4
|
+
* Pre-built components for rendering Portable Text content from WordPress imports.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```astro
|
|
8
|
+
* ---
|
|
9
|
+
* import { PortableText } from "dineway/ui";
|
|
10
|
+
* ---
|
|
11
|
+
* <PortableText value={post.data.content} />
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The PortableText component uses Dineway's built-in renderers by default.
|
|
15
|
+
* Pass custom components to override specific types:
|
|
16
|
+
*
|
|
17
|
+
* ```astro
|
|
18
|
+
* <PortableText value={content} components={{ type: { image: MyImage } }} />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// Wrapper component with Dineway defaults
|
|
23
|
+
export { default as PortableText } from "./PortableText.astro";
|
|
24
|
+
|
|
25
|
+
// Comment components
|
|
26
|
+
export { default as Comments } from "./Comments.astro";
|
|
27
|
+
export { default as CommentForm } from "./CommentForm.astro";
|
|
28
|
+
|
|
29
|
+
// Widget components
|
|
30
|
+
export { default as WidgetArea } from "./WidgetArea.astro";
|
|
31
|
+
|
|
32
|
+
// Main Image component for Dineway media
|
|
33
|
+
export { default as DinewayImage } from "./DinewayImage.astro";
|
|
34
|
+
|
|
35
|
+
// Unified Media component (supports all providers)
|
|
36
|
+
export { default as DinewayMedia } from "./DinewayMedia.astro";
|
|
37
|
+
|
|
38
|
+
// Portable Text block type components
|
|
39
|
+
export { default as Image } from "./Image.astro";
|
|
40
|
+
export { default as Code } from "./Code.astro";
|
|
41
|
+
export { default as Embed } from "./Embed.astro";
|
|
42
|
+
export { default as Gallery } from "./Gallery.astro";
|
|
43
|
+
export { default as Columns } from "./Columns.astro";
|
|
44
|
+
export { default as Break } from "./Break.astro";
|
|
45
|
+
export { default as HtmlBlock } from "./HtmlBlock.astro";
|
|
46
|
+
export { default as Table } from "./Table.astro";
|
|
47
|
+
export { default as Button } from "./Button.astro";
|
|
48
|
+
export { default as Buttons } from "./Buttons.astro";
|
|
49
|
+
export { default as Cover } from "./Cover.astro";
|
|
50
|
+
export { default as File } from "./File.astro";
|
|
51
|
+
export { default as Pullquote } from "./Pullquote.astro";
|
|
52
|
+
|
|
53
|
+
// Mark components
|
|
54
|
+
export { default as Superscript } from "./marks/Superscript.astro";
|
|
55
|
+
export { default as Subscript } from "./marks/Subscript.astro";
|
|
56
|
+
export { default as Underline } from "./marks/Underline.astro";
|
|
57
|
+
export { default as StrikeThrough } from "./marks/StrikeThrough.astro";
|
|
58
|
+
export { default as Link } from "./marks/Link.astro";
|
|
59
|
+
|
|
60
|
+
import BreakComponent from "./Break.astro";
|
|
61
|
+
import ButtonComponent from "./Button.astro";
|
|
62
|
+
import ButtonsComponent from "./Buttons.astro";
|
|
63
|
+
import CodeComponent from "./Code.astro";
|
|
64
|
+
import ColumnsComponent from "./Columns.astro";
|
|
65
|
+
import CoverComponent from "./Cover.astro";
|
|
66
|
+
import EmbedComponent from "./Embed.astro";
|
|
67
|
+
import FileComponent from "./File.astro";
|
|
68
|
+
import GalleryComponent from "./Gallery.astro";
|
|
69
|
+
import HtmlBlockComponent from "./HtmlBlock.astro";
|
|
70
|
+
// Pre-configured components object for PortableText
|
|
71
|
+
import ImageComponent from "./Image.astro";
|
|
72
|
+
import { dinewayMarkComponents } from "./marks.js";
|
|
73
|
+
import PullquoteComponent from "./Pullquote.astro";
|
|
74
|
+
import TableComponent from "./Table.astro";
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Pre-configured components for Dineway Portable Text content
|
|
78
|
+
*
|
|
79
|
+
* Includes renderers for:
|
|
80
|
+
* - Block types: image, code, embed, gallery, columns, break, htmlBlock, table,
|
|
81
|
+
* button, buttons, cover, file, pullquote
|
|
82
|
+
* - Marks: superscript, subscript, underline, strike-through, link
|
|
83
|
+
*/
|
|
84
|
+
export const dinewayComponents = {
|
|
85
|
+
type: {
|
|
86
|
+
image: ImageComponent,
|
|
87
|
+
code: CodeComponent,
|
|
88
|
+
embed: EmbedComponent,
|
|
89
|
+
gallery: GalleryComponent,
|
|
90
|
+
columns: ColumnsComponent,
|
|
91
|
+
break: BreakComponent,
|
|
92
|
+
htmlBlock: HtmlBlockComponent,
|
|
93
|
+
table: TableComponent,
|
|
94
|
+
button: ButtonComponent,
|
|
95
|
+
buttons: ButtonsComponent,
|
|
96
|
+
cover: CoverComponent,
|
|
97
|
+
file: FileComponent,
|
|
98
|
+
pullquote: PullquoteComponent,
|
|
99
|
+
},
|
|
100
|
+
mark: dinewayMarkComponents,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Public page contribution components
|
|
104
|
+
export { default as DinewayHead } from "./DinewayHead.astro";
|
|
105
|
+
export { default as DinewayBodyStart } from "./DinewayBodyStart.astro";
|
|
106
|
+
export { default as DinewayBodyEnd } from "./DinewayBodyEnd.astro";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { sanitizeHref } from "../../utils/url.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Portable Text Link mark component
|
|
6
|
+
*
|
|
7
|
+
* Receives node with markDef containing link details from astro-portabletext
|
|
8
|
+
*/
|
|
9
|
+
export interface Props {
|
|
10
|
+
node: {
|
|
11
|
+
markDef: {
|
|
12
|
+
_type: "link";
|
|
13
|
+
_key: string;
|
|
14
|
+
href: string;
|
|
15
|
+
blank?: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { node } = Astro.props;
|
|
21
|
+
const href = sanitizeHref(node?.markDef?.href);
|
|
22
|
+
const blank = node?.markDef?.blank;
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<a
|
|
26
|
+
href={href}
|
|
27
|
+
target={blank ? "_blank" : undefined}
|
|
28
|
+
rel={blank ? "noopener noreferrer" : undefined}
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</a>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mark component map for Portable Text rendering.
|
|
3
|
+
*
|
|
4
|
+
* Used by the top-level `dinewayComponents` config and block components that
|
|
5
|
+
* render nested inline content through the Portable Text pipeline.
|
|
6
|
+
*/
|
|
7
|
+
import LinkMark from "./marks/Link.astro";
|
|
8
|
+
import StrikeThroughMark from "./marks/StrikeThrough.astro";
|
|
9
|
+
import SubscriptMark from "./marks/Subscript.astro";
|
|
10
|
+
import SuperscriptMark from "./marks/Superscript.astro";
|
|
11
|
+
import UnderlineMark from "./marks/Underline.astro";
|
|
12
|
+
|
|
13
|
+
export const dinewayMarkComponents = {
|
|
14
|
+
superscript: SuperscriptMark,
|
|
15
|
+
subscript: SubscriptMark,
|
|
16
|
+
underline: UnderlineMark,
|
|
17
|
+
"strike-through": StrikeThroughMark,
|
|
18
|
+
link: LinkMark,
|
|
19
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getDinewayCollection } from "../../query.js";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
type?: "monthly" | "yearly";
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { type = "monthly", limit = 12 } = Astro.props;
|
|
10
|
+
|
|
11
|
+
// Get all posts to build archives
|
|
12
|
+
const { entries: posts } = await getDinewayCollection("posts", {
|
|
13
|
+
orderBy: { published_at: "desc" },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Group posts by date
|
|
17
|
+
const archives = new Map<string, { label: string; count: number; url: string }>();
|
|
18
|
+
|
|
19
|
+
for (const post of posts) {
|
|
20
|
+
const publishedAt = post.data.publishedAt;
|
|
21
|
+
if (typeof publishedAt !== "string") continue;
|
|
22
|
+
|
|
23
|
+
const date = new Date(publishedAt);
|
|
24
|
+
let key: string;
|
|
25
|
+
let label: string;
|
|
26
|
+
let url: string;
|
|
27
|
+
|
|
28
|
+
if (type === "yearly") {
|
|
29
|
+
const year = date.getFullYear();
|
|
30
|
+
key = `${year}`;
|
|
31
|
+
label = `${year}`;
|
|
32
|
+
url = `/archives/${year}`;
|
|
33
|
+
} else {
|
|
34
|
+
const year = date.getFullYear();
|
|
35
|
+
const month = date.getMonth() + 1;
|
|
36
|
+
key = `${year}-${month.toString().padStart(2, "0")}`;
|
|
37
|
+
label = date.toLocaleDateString("en-US", {
|
|
38
|
+
year: "numeric",
|
|
39
|
+
month: "long",
|
|
40
|
+
});
|
|
41
|
+
url = `/archives/${year}/${month.toString().padStart(2, "0")}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!archives.has(key)) {
|
|
45
|
+
archives.set(key, { label, count: 0, url });
|
|
46
|
+
}
|
|
47
|
+
archives.get(key)!.count++;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Convert to array and limit
|
|
51
|
+
const archiveList = [...archives.values()].slice(0, limit);
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
<ul class="widget-archives">
|
|
55
|
+
{
|
|
56
|
+
archiveList.map((archive) => (
|
|
57
|
+
<li>
|
|
58
|
+
<a href={archive.url} class="widget-archives__link">
|
|
59
|
+
{archive.label}
|
|
60
|
+
</a>
|
|
61
|
+
<span class="widget-archives__count">({archive.count})</span>
|
|
62
|
+
</li>
|
|
63
|
+
))
|
|
64
|
+
}
|
|
65
|
+
</ul>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Categories widget component
|
|
4
|
+
* Displays a list of categories with optional post counts
|
|
5
|
+
*/
|
|
6
|
+
import { getTaxonomyTerms } from "../../taxonomies/index.js";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
showCount?: boolean;
|
|
10
|
+
hierarchical?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { showCount = true, hierarchical = true } = Astro.props;
|
|
14
|
+
|
|
15
|
+
const categories = await getTaxonomyTerms("category");
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<ul class="widget-categories">
|
|
19
|
+
{
|
|
20
|
+
categories.length > 0 ? (
|
|
21
|
+
categories.map((category) => (
|
|
22
|
+
<li>
|
|
23
|
+
<a href={`/category/${category.slug}`} class="widget-categories__link">
|
|
24
|
+
{category.label}
|
|
25
|
+
</a>
|
|
26
|
+
{showCount && category.count !== undefined && (
|
|
27
|
+
<span class="widget-categories__count">({category.count})</span>
|
|
28
|
+
)}
|
|
29
|
+
</li>
|
|
30
|
+
))
|
|
31
|
+
) : (
|
|
32
|
+
<li class="widget-categories__empty">No categories yet</li>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
</ul>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getDinewayCollection } from "../../query.js";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
count?: number;
|
|
6
|
+
showThumbnails?: boolean;
|
|
7
|
+
showDate?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { count = 5, showThumbnails = false, showDate = true } = Astro.props;
|
|
11
|
+
|
|
12
|
+
const { entries: posts } = await getDinewayCollection("posts", {
|
|
13
|
+
limit: count,
|
|
14
|
+
orderBy: { published_at: "desc" },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Helper to get typed values from dynamic data
|
|
18
|
+
function getString(data: Record<string, unknown>, key: string): string | undefined {
|
|
19
|
+
const val = data[key];
|
|
20
|
+
return typeof val === "string" ? val : undefined;
|
|
21
|
+
}
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<ul class="widget-recent-posts">
|
|
25
|
+
{
|
|
26
|
+
posts.map((post) => {
|
|
27
|
+
const publishedAt = getString(post.data, "publishedAt");
|
|
28
|
+
const featuredImage = getString(post.data, "featured_image");
|
|
29
|
+
const title = getString(post.data, "title");
|
|
30
|
+
return (
|
|
31
|
+
<li>
|
|
32
|
+
{showThumbnails && featuredImage && (
|
|
33
|
+
<img
|
|
34
|
+
src={featuredImage}
|
|
35
|
+
alt=""
|
|
36
|
+
class="widget-recent-posts__thumbnail"
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
39
|
+
<a href={`/posts/${post.id}`} class="widget-recent-posts__link">
|
|
40
|
+
{title}
|
|
41
|
+
</a>
|
|
42
|
+
{showDate && publishedAt && (
|
|
43
|
+
<time datetime={publishedAt} class="widget-recent-posts__date">
|
|
44
|
+
{new Date(publishedAt).toLocaleDateString()}
|
|
45
|
+
</time>
|
|
46
|
+
)}
|
|
47
|
+
</li>
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
</ul>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { placeholder = "Search..." } = Astro.props;
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<form method="get" action="/search" class="widget-search">
|
|
10
|
+
<input
|
|
11
|
+
type="search"
|
|
12
|
+
name="q"
|
|
13
|
+
placeholder={placeholder}
|
|
14
|
+
aria-label="Search"
|
|
15
|
+
class="widget-search__input"
|
|
16
|
+
/>
|
|
17
|
+
<button type="submit" class="widget-search__button">Search</button>
|
|
18
|
+
</form>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Tags widget component
|
|
4
|
+
* Displays a tag cloud with optional counts
|
|
5
|
+
*/
|
|
6
|
+
import { getTaxonomyTerms } from "../../taxonomies/index.js";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
showCount?: boolean;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { showCount = false, limit = 20 } = Astro.props;
|
|
14
|
+
|
|
15
|
+
const allTags = await getTaxonomyTerms("tag");
|
|
16
|
+
const tags = allTags.slice(0, limit);
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<div class="widget-tags">
|
|
20
|
+
{
|
|
21
|
+
tags.length > 0 ? (
|
|
22
|
+
<ul class="widget-tags__cloud">
|
|
23
|
+
{tags.map((tag) => (
|
|
24
|
+
<li>
|
|
25
|
+
<a href={`/tag/${tag.slug}`} class="widget-tags__link">
|
|
26
|
+
{tag.label}
|
|
27
|
+
</a>
|
|
28
|
+
{showCount && tag.count !== undefined && (
|
|
29
|
+
<span class="widget-tags__count">({tag.count})</span>
|
|
30
|
+
)}
|
|
31
|
+
</li>
|
|
32
|
+
))}
|
|
33
|
+
</ul>
|
|
34
|
+
) : (
|
|
35
|
+
<p class="widget-tags__empty">No tags yet</p>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
</div>
|