Skip to content

Commit 8e0dbe4

Browse files
authored
Transfer enhanced VLT schema (#30)
* Transfer enhanced VLT schema * Remove SemanticUI button * changelog * lock
1 parent 2ca1a75 commit 8e0dbe4

File tree

7 files changed

+55
-11
lines changed

7 files changed

+55
-11
lines changed

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ module.exports = {
3939
message:
4040
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
4141
},
42+
{
43+
name: 'semantic-ui-react',
44+
message:
45+
'Semantic UI is not allowed in this add-on. Please use `@plone/components` instead.',
46+
},
4247
],
4348
'react/jsx-key': [2, { checkFragmentShorthand: true }],
4449
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed SemancticUI Button, use `@plone/components` button instead. @sneridagh
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Transfer VLT enhanced schema to the add-on. @sneridagh

packages/volto-button-block/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"@kitconcept/volto-bm3-compat"
2727
],
2828
"dependencies": {
29-
"@kitconcept/volto-bm3-compat": "1.0.0-alpha.1"
29+
"@kitconcept/volto-bm3-compat": "1.0.0-alpha.1",
30+
"@plone/components": "workspace:*"
3031
},
3132
"peerDependencies": {
3233
"classnames": "^2.5.1",

packages/volto-button-block/src/components/View.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { defineMessages, useIntl } from 'react-intl';
3-
import { Button } from 'semantic-ui-react';
3+
import { Button } from '@plone/components';
44
import cx from 'classnames';
55
import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
66
import { BlockWrapper } from '@kitconcept/volto-bm3-compat';

packages/volto-button-block/src/components/schema.js

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineMessages } from 'react-intl';
2+
import { addStyling } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer';
23

34
const messages = defineMessages({
45
ButtonBlock: {
@@ -25,18 +26,25 @@ const messages = defineMessages({
2526
id: 'Open in a new tab',
2627
defaultMessage: 'Open in a new tab',
2728
},
29+
BlockWidth: {
30+
id: 'Block Width',
31+
defaultMessage: 'Block Width',
32+
},
33+
Alignment: {
34+
id: 'Alignment',
35+
defaultMessage: 'Alignment',
36+
},
2837
});
2938

3039
export const ButtonSchema = (props) => {
3140
const { intl } = props;
32-
33-
return {
41+
const schema = {
3442
title: intl.formatMessage(messages.ButtonBlock),
3543
fieldsets: [
3644
{
3745
id: 'default',
3846
title: 'Default',
39-
fields: ['title', 'href', 'openLinkInNewTab', 'inneralign'],
47+
fields: ['title', 'href', 'openLinkInNewTab'],
4048
},
4149
],
4250

@@ -51,17 +59,38 @@ export const ButtonSchema = (props) => {
5159
selectedItemAttrs: ['Title', 'Description', 'hasPreviewImage'],
5260
allowExternals: true,
5361
},
54-
inneralign: {
55-
title: props.intl.formatMessage(messages.innerAlign),
56-
widget: 'align',
57-
actions: ['left', 'center', 'right'],
58-
default: 'left',
59-
},
6062
openLinkInNewTab: {
6163
title: intl.formatMessage(messages.openLinkInNewTab),
6264
type: 'boolean',
6365
},
6466
},
6567
required: [],
6668
};
69+
70+
addStyling({ schema, intl });
71+
72+
schema.properties.styles.schema.fieldsets[0].fields = [
73+
'blockWidth:noprefix',
74+
...schema.properties.styles.schema.fieldsets[0].fields,
75+
];
76+
77+
schema.properties.styles.schema.fieldsets[0].fields = [
78+
'align:noprefix',
79+
...schema.properties.styles.schema.fieldsets[0].fields,
80+
];
81+
82+
schema.properties.styles.schema.properties['blockWidth:noprefix'] = {
83+
widget: 'blockWidth',
84+
title: intl.formatMessage(messages.BlockWidth),
85+
default: 'default',
86+
filterActions: ['narrow', 'default'],
87+
};
88+
89+
schema.properties.styles.schema.properties['align:noprefix'] = {
90+
widget: 'blockAlignment',
91+
title: intl.formatMessage(messages.Alignment),
92+
default: 'left',
93+
};
94+
95+
return schema;
6796
};

pnpm-lock.yaml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)