Skip to content

Commit

Permalink
fix: add icon capabilities to storyblok
Browse files Browse the repository at this point in the history
  • Loading branch information
julrich committed Oct 14, 2024
1 parent 76e5ccb commit 3dd7c89
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@kickstartds/jsonschema2storyblok",
"comment": "add icon capabilities to Storyblok",
"type": "patch"
}
],
"packageName": "@kickstartds/jsonschema2storyblok"
}
6 changes: 5 additions & 1 deletion tools/jsonschema2storyblok/src/@types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type GenericType =
| 'multiasset'
| 'multilink'
| 'table'
| 'tab';
| 'tab'
| 'custom';

export type AssetType = 'images' | 'videos';

Expand Down Expand Up @@ -83,6 +84,9 @@ export interface IStoryblokSchemaElement {
// type: `date`
disable_time?: boolean;

// type: `custom`
field_type?: string;

objectFields?: IStoryblokSchemaElement[];
}

Expand Down
6 changes: 6 additions & 0 deletions tools/jsonschema2storyblok/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,12 @@ function processBasic({
type
};

if (subSchema.type === 'string' && subSchema.format && subSchema.format === 'icon') {
field.type = 'custom';
field.field_type = 'storyblok-icon-sprite-picker-field-plugin';
field.options = [];
}

if (subSchema.type === 'string' && subSchema.format && subSchema.format === 'image') {
field.type = 'asset';
field.filetypes = ['images'];
Expand Down

0 comments on commit 3dd7c89

Please sign in to comment.