@hello-better/sanity-blog 0.1.1 → 0.1.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blogBlock.d.ts","sourceRoot":"","sources":["../../../src/schema/blocks/blogBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blogBlock.d.ts","sourceRoot":"","sources":["../../../src/schema/blocks/blogBlock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAElE,eAAO,MAAM,eAAe,GAAI,UAAS,iBAAsB;;;;;;;;CAqF9D,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;CAAoB,CAAA;AAE1C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;CAIjC,CAAA"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { defineField, defineType } from 'sanity';
|
|
2
|
-
import {
|
|
3
|
-
import { hiddenAllFieldsGroup } from '@hello-better/sanity-core';
|
|
2
|
+
import { createBaseBlockFields, createBlockGroups } from '@hello-better/sanity-core';
|
|
4
3
|
import { createRichTextField } from '@hello-better/sanity-content-block';
|
|
5
|
-
const defaultSpacingOptions = [
|
|
6
|
-
{ title: 'None', value: 'none' },
|
|
7
|
-
{ title: 'Small', value: 'sm' },
|
|
8
|
-
{ title: 'Medium', value: 'md' },
|
|
9
|
-
{ title: 'Large', value: 'lg' },
|
|
10
|
-
{ title: 'Extra Large', value: 'xl' },
|
|
11
|
-
];
|
|
12
4
|
export const createBlogBlock = (options = {}) => {
|
|
13
5
|
const blockTypeName = options.blogBlockTypeName ?? 'blogBlock';
|
|
14
6
|
const streamTypeName = options.blogStreamTypeName ?? 'blogStream';
|
|
@@ -21,16 +13,11 @@ export const createBlogBlock = (options = {}) => {
|
|
|
21
13
|
const featuredBlogFieldName = options.blockFeaturedBlogFieldName ?? 'featuredBlog';
|
|
22
14
|
const defaultPostsPerPage = options.defaultPostsPerPage ?? 9;
|
|
23
15
|
const maxPostsPerPage = options.maxPostsPerPage ?? 50;
|
|
24
|
-
const spacingOptions = options.spacingOptions ?? defaultSpacingOptions;
|
|
25
16
|
return defineType({
|
|
26
17
|
name: blockTypeName,
|
|
27
18
|
title: 'Blog Block',
|
|
28
19
|
type: 'object',
|
|
29
|
-
groups:
|
|
30
|
-
{ name: 'content', title: 'Content', icon: DocumentTextIcon, default: true },
|
|
31
|
-
{ name: 'settings', title: 'Settings', icon: CogIcon },
|
|
32
|
-
hiddenAllFieldsGroup,
|
|
33
|
-
],
|
|
20
|
+
groups: createBlockGroups(),
|
|
34
21
|
fields: [
|
|
35
22
|
defineField({
|
|
36
23
|
name: titleFieldName,
|
|
@@ -75,31 +62,8 @@ export const createBlogBlock = (options = {}) => {
|
|
|
75
62
|
to: [{ type: postTypeName }],
|
|
76
63
|
description: 'Optionally pin a specific post as the featured entry.',
|
|
77
64
|
}),
|
|
78
|
-
defineField({
|
|
79
|
-
name: 'paddingTop',
|
|
80
|
-
title: 'Padding Top',
|
|
81
|
-
type: 'string',
|
|
82
|
-
group: 'settings',
|
|
83
|
-
initialValue: 'md',
|
|
84
|
-
options: { layout: 'dropdown', list: spacingOptions },
|
|
85
|
-
}),
|
|
86
|
-
defineField({
|
|
87
|
-
name: 'paddingBottom',
|
|
88
|
-
title: 'Padding Bottom',
|
|
89
|
-
type: 'string',
|
|
90
|
-
group: 'settings',
|
|
91
|
-
initialValue: 'md',
|
|
92
|
-
options: { layout: 'dropdown', list: spacingOptions },
|
|
93
|
-
}),
|
|
94
|
-
defineField({
|
|
95
|
-
name: 'marginTop',
|
|
96
|
-
title: 'Margin Top',
|
|
97
|
-
type: 'string',
|
|
98
|
-
group: 'settings',
|
|
99
|
-
initialValue: 'none',
|
|
100
|
-
options: { layout: 'dropdown', list: spacingOptions },
|
|
101
|
-
}),
|
|
102
65
|
...(options.additionalBlockFields ?? []),
|
|
66
|
+
...createBaseBlockFields(options),
|
|
103
67
|
],
|
|
104
68
|
preview: {
|
|
105
69
|
select: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blogBlock.js","sourceRoot":"","sources":["../../../src/schema/blocks/blogBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"blogBlock.js","sourceRoot":"","sources":["../../../src/schema/blocks/blogBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAC,qBAAqB,EAAE,iBAAiB,EAAC,MAAM,2BAA2B,CAAA;AAClF,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAA;AAGtE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAA6B,EAAE,EAAE,EAAE;IACjE,MAAM,aAAa,GAAG,OAAO,CAAC,iBAAiB,IAAI,WAAW,CAAA;IAC9D,MAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,IAAI,YAAY,CAAA;IACjE,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,IAAI,UAAU,CAAA;IAE3D,MAAM,cAAc,GAAG,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAA;IAC7D,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,IAAI,MAAM,CAAA;IAC1D,MAAM,eAAe,GAAG,OAAO,CAAC,oBAAoB,IAAI,QAAQ,CAAA;IAChE,MAAM,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,IAAI,aAAa,CAAA;IAC/E,MAAM,qBAAqB,GAAG,OAAO,CAAC,0BAA0B,IAAI,cAAc,CAAA;IAClF,MAAM,qBAAqB,GAAG,OAAO,CAAC,0BAA0B,IAAI,cAAc,CAAA;IAElF,MAAM,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI,CAAC,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gBACjB,KAAK,EAAE,SAAS;gBAChB,EAAE,EAAE,CAAC,EAAC,IAAI,EAAE,YAAY,EAAC,CAAC;gBAC1B,WAAW,EAAE,uDAAuD;aACrE,CAAC;YAEF,GAAG,CAAC,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAC;YAExC,GAAG,qBAAqB,CAAC,OAAO,CAAC;SAClC;QACD,OAAO,EAAE;YACP,MAAM,EAAE;gBACN,KAAK,EAAE,cAAc;gBACrB,WAAW,EAAE,GAAG,eAAe,QAAQ;aACxC;YACD,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,WAAW,EAAC,EAAE,EAAE,CAAC,CAAC;gBAClC,KAAK,EAAE,KAAK,IAAI,YAAY;gBAC5B,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC,CAAC,YAAY;aAChE,CAAC;SACH;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,SAAS;CAChB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hello-better/sanity-blog",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Sanity blog module with Blog Stream, Blog Post, Blog Tag documents and Blog Block — inspired by Silverstripe's blog module.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|