@plone/volto 19.0.0-alpha.29 → 19.0.0-alpha.30
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/CHANGELOG.md +37 -0
- package/locales/af/LC_MESSAGES/volto.po +45 -0
- package/locales/af.json +1 -1
- package/locales/ar/LC_MESSAGES/volto.po +45 -0
- package/locales/ar.json +1 -1
- package/locales/bg/LC_MESSAGES/volto.po +45 -0
- package/locales/bg.json +1 -1
- package/locales/bn/LC_MESSAGES/volto.po +45 -0
- package/locales/bn.json +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +45 -0
- package/locales/ca.json +1 -1
- package/locales/cs/LC_MESSAGES/volto.po +45 -0
- package/locales/cs.json +1 -1
- package/locales/cy/LC_MESSAGES/volto.po +45 -0
- package/locales/cy.json +1 -1
- package/locales/da/LC_MESSAGES/volto.po +45 -0
- package/locales/da.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +45 -0
- package/locales/de.json +1 -1
- package/locales/el/LC_MESSAGES/volto.po +45 -0
- package/locales/el.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +45 -0
- package/locales/en.json +1 -1
- package/locales/en_AU/LC_MESSAGES/volto.po +45 -0
- package/locales/en_AU.json +1 -1
- package/locales/en_GB/LC_MESSAGES/volto.po +45 -0
- package/locales/en_GB.json +1 -1
- package/locales/eo/LC_MESSAGES/volto.po +45 -0
- package/locales/eo.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +45 -0
- package/locales/es.json +1 -1
- package/locales/et/LC_MESSAGES/volto.po +45 -0
- package/locales/et.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +45 -0
- package/locales/eu.json +1 -1
- package/locales/fa/LC_MESSAGES/volto.po +45 -0
- package/locales/fa.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +45 -0
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +45 -0
- package/locales/fr.json +1 -1
- package/locales/fu/LC_MESSAGES/volto.po +45 -0
- package/locales/fu.json +1 -1
- package/locales/gl/LC_MESSAGES/volto.po +45 -0
- package/locales/gl.json +1 -1
- package/locales/he/LC_MESSAGES/volto.po +45 -0
- package/locales/he.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +45 -0
- package/locales/hi.json +1 -1
- package/locales/hr/LC_MESSAGES/volto.po +45 -0
- package/locales/hr.json +1 -1
- package/locales/hu/LC_MESSAGES/volto.po +45 -0
- package/locales/hu.json +1 -1
- package/locales/hy/LC_MESSAGES/volto.po +45 -0
- package/locales/hy.json +1 -1
- package/locales/id/LC_MESSAGES/volto.po +45 -0
- package/locales/id.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +45 -0
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +45 -0
- package/locales/ja.json +1 -1
- package/locales/ka/LC_MESSAGES/volto.po +45 -0
- package/locales/ka.json +1 -1
- package/locales/kn/LC_MESSAGES/volto.po +45 -0
- package/locales/kn.json +1 -1
- package/locales/ko/LC_MESSAGES/volto.po +45 -0
- package/locales/ko.json +1 -1
- package/locales/lt/LC_MESSAGES/volto.po +45 -0
- package/locales/lt.json +1 -1
- package/locales/lv/LC_MESSAGES/volto.po +45 -0
- package/locales/lv.json +1 -1
- package/locales/mi/LC_MESSAGES/volto.po +45 -0
- package/locales/mi.json +1 -1
- package/locales/mk/LC_MESSAGES/volto.po +45 -0
- package/locales/mk.json +1 -1
- package/locales/my/LC_MESSAGES/volto.po +45 -0
- package/locales/my.json +1 -1
- package/locales/nb_NO/LC_MESSAGES/volto.po +45 -0
- package/locales/nb_NO.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +45 -0
- package/locales/nl.json +1 -1
- package/locales/nn/LC_MESSAGES/volto.po +45 -0
- package/locales/nn.json +1 -1
- package/locales/pl/LC_MESSAGES/volto.po +45 -0
- package/locales/pl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +45 -0
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +45 -0
- package/locales/pt_BR.json +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +45 -0
- package/locales/rm.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +100 -55
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +45 -0
- package/locales/ru.json +1 -1
- package/locales/sk/LC_MESSAGES/volto.po +45 -0
- package/locales/sk.json +1 -1
- package/locales/sl/LC_MESSAGES/volto.po +45 -0
- package/locales/sl.json +1 -1
- package/locales/sm/LC_MESSAGES/volto.po +45 -0
- package/locales/sm.json +1 -1
- package/locales/sq/LC_MESSAGES/volto.po +45 -0
- package/locales/sq.json +1 -1
- package/locales/sr/LC_MESSAGES/volto.po +45 -0
- package/locales/sr.json +1 -1
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +45 -0
- package/locales/sr@cyrl.json +1 -1
- package/locales/sr@latn/LC_MESSAGES/volto.po +45 -0
- package/locales/sr@latn.json +1 -1
- package/locales/sv/LC_MESSAGES/volto.po +45 -0
- package/locales/sv.json +1 -1
- package/locales/ta/LC_MESSAGES/volto.po +45 -0
- package/locales/ta.json +1 -1
- package/locales/te/LC_MESSAGES/volto.po +45 -0
- package/locales/te.json +1 -1
- package/locales/th/LC_MESSAGES/volto.po +45 -0
- package/locales/th.json +1 -1
- package/locales/to/LC_MESSAGES/volto.po +45 -0
- package/locales/to.json +1 -1
- package/locales/tr/LC_MESSAGES/volto.po +45 -0
- package/locales/tr.json +1 -1
- package/locales/uk/LC_MESSAGES/volto.po +45 -0
- package/locales/uk.json +1 -1
- package/locales/vi/LC_MESSAGES/volto.po +45 -0
- package/locales/vi.json +1 -1
- package/locales/volto.pot +46 -1
- package/locales/zh_CN/LC_MESSAGES/volto.po +45 -0
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant/LC_MESSAGES/volto.po +45 -0
- package/locales/zh_Hant.json +1 -1
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +45 -0
- package/locales/zh_Hant_HK.json +1 -1
- package/package.json +26 -28
- package/src/components/manage/Blocks/Block/Order/Item.jsx +18 -10
- package/src/components/manage/Blocks/Block/Order/Item.test.jsx +90 -0
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +4 -3
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.test.jsx +3 -0
- package/src/components/manage/Toast/Toast.jsx +32 -0
- package/src/components/manage/Toast/Toast.test.jsx +9 -5
- package/src/components/manage/Widgets/UrlWidget.jsx +47 -18
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -0
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +30 -0
- package/src/components/theme/Sitemap/Sitemap.stories.jsx +82 -0
- package/src/components/theme/Unauthorized/Unauthorized.jsx +30 -23
- package/src/components/theme/Unauthorized/Unauthorized.test.jsx +28 -1
- package/src/components/theme/View/EventView.stories.jsx +89 -0
- package/src/components/theme/View/FileView.stories.jsx +50 -0
- package/src/components/theme/View/LinkView.stories.jsx +57 -0
- package/src/components/theme/View/ListingView.stories.jsx +70 -0
- package/src/components/theme/View/NewsItemView.stories.jsx +58 -0
- package/src/components/theme/View/RenderBlocks.stories.jsx +112 -0
- package/src/components/theme/View/SummaryView.stories.jsx +71 -0
- package/src/components/theme/View/TabularView.stories.jsx +66 -0
- package/src/helpers/FormValidation/validators.ts +15 -2
- package/theme/themes/pastanaga/extras/main.less +1 -0
- package/types/components/manage/Blocks/Block/Order/Item.test.d.ts +1 -0
- package/types/components/theme/Sitemap/Sitemap.stories.d.ts +13 -0
- package/types/components/theme/View/EventView.stories.d.ts +19 -0
- package/types/components/theme/View/FileView.stories.d.ts +18 -0
- package/types/components/theme/View/LinkView.stories.d.ts +18 -0
- package/types/components/theme/View/ListingView.stories.d.ts +24 -0
- package/types/components/theme/View/NewsItemView.stories.d.ts +23 -0
- package/types/components/theme/View/RenderBlocks.stories.d.ts +23 -0
- package/types/components/theme/View/SummaryView.stories.d.ts +23 -0
- package/types/components/theme/View/TabularView.stories.d.ts +23 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import SitemapComponent from './Sitemap';
|
|
3
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
4
|
+
|
|
5
|
+
const IntlSitemapComponent = injectIntl(SitemapComponent);
|
|
6
|
+
|
|
7
|
+
function StoryComponent(args) {
|
|
8
|
+
// Add mock location object
|
|
9
|
+
const mockLocation = {
|
|
10
|
+
pathname: '/sitemap',
|
|
11
|
+
search: '',
|
|
12
|
+
hash: '',
|
|
13
|
+
state: null,
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<Wrapper
|
|
17
|
+
customStore={{
|
|
18
|
+
navigation: {
|
|
19
|
+
url: 'http://localhost:8080/Plone/@navigation',
|
|
20
|
+
...args,
|
|
21
|
+
},
|
|
22
|
+
intl: {
|
|
23
|
+
locale: 'en',
|
|
24
|
+
messages: {},
|
|
25
|
+
},
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
29
|
+
<IntlSitemapComponent
|
|
30
|
+
location={mockLocation}
|
|
31
|
+
getNavigation={() => {}}
|
|
32
|
+
lang="en"
|
|
33
|
+
items={args.items}
|
|
34
|
+
/>
|
|
35
|
+
</Wrapper>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Sitemap = StoryComponent.bind({});
|
|
40
|
+
Sitemap.args = {
|
|
41
|
+
items: [
|
|
42
|
+
{
|
|
43
|
+
url: 'http://localhost:8080/Plone/page-1',
|
|
44
|
+
description: '',
|
|
45
|
+
items: [
|
|
46
|
+
{
|
|
47
|
+
url: 'http://localhost:8080/Plone/page-1/page-1-2',
|
|
48
|
+
description: '',
|
|
49
|
+
title: 'Page 1-2',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
url: 'http://localhost:8080/Plone/page-1/page-1-3',
|
|
53
|
+
description: '',
|
|
54
|
+
title: 'Page 1-3',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
title: 'Page 1-3',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
url: 'http://localhost:8080/Plone/page-2',
|
|
61
|
+
description: '',
|
|
62
|
+
title: 'Page 2',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
export default {
|
|
67
|
+
title: 'Public components/Sitemap',
|
|
68
|
+
component: Sitemap,
|
|
69
|
+
decorators: [
|
|
70
|
+
(Story) => (
|
|
71
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
72
|
+
<Story />
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
],
|
|
76
|
+
argTypes: {
|
|
77
|
+
items: {
|
|
78
|
+
control: 'object',
|
|
79
|
+
description: 'url,description,title of the pages mentioned',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -4,10 +4,10 @@ import { Container } from 'semantic-ui-react';
|
|
|
4
4
|
import { useSelector } from 'react-redux';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
6
|
import { withServerErrorCode } from '@plone/volto/helpers/Utils/Utils';
|
|
7
|
-
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
8
7
|
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
9
8
|
|
|
10
9
|
const Unauthorized = () => {
|
|
10
|
+
const token = useSelector((state) => state.userSession.token);
|
|
11
11
|
const error_message = useSelector((state) => state.apierror?.message);
|
|
12
12
|
let location = useLocation();
|
|
13
13
|
|
|
@@ -19,28 +19,35 @@ const Unauthorized = () => {
|
|
|
19
19
|
</h1>
|
|
20
20
|
<h3>{error_message}</h3>
|
|
21
21
|
<p className="description">
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
{token ? (
|
|
23
|
+
<FormattedMessage
|
|
24
|
+
id="You are trying to access a protected resource."
|
|
25
|
+
defaultMessage="You are trying to access a protected resource."
|
|
26
|
+
/>
|
|
27
|
+
) : (
|
|
28
|
+
<FormattedMessage
|
|
29
|
+
id="You are trying to access a protected resource, please {login} first."
|
|
30
|
+
defaultMessage="You are trying to access a protected resource, please {login} first."
|
|
31
|
+
values={{
|
|
32
|
+
login: (
|
|
33
|
+
<Link
|
|
34
|
+
to={{
|
|
35
|
+
pathname: `${location.pathname.replace(/\/$/, '')}/login`,
|
|
36
|
+
state: {
|
|
37
|
+
// This is needed to cover the use case of being logged in in
|
|
38
|
+
// another backend (eg. in development), having a token for
|
|
39
|
+
// localhost and try to use it, the login route has to know that
|
|
40
|
+
// it's the same as it comes from a logout
|
|
41
|
+
isLogout: true,
|
|
42
|
+
},
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<FormattedMessage id="log in" defaultMessage="log in" />
|
|
46
|
+
</Link>
|
|
47
|
+
),
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
44
51
|
</p>
|
|
45
52
|
<p>
|
|
46
53
|
<FormattedMessage
|
|
@@ -9,8 +9,35 @@ import Unauthorized from './Unauthorized';
|
|
|
9
9
|
const mockStore = configureStore();
|
|
10
10
|
|
|
11
11
|
describe('Unauthorized', () => {
|
|
12
|
-
it('renders
|
|
12
|
+
it('renders an unauthorized component', () => {
|
|
13
13
|
const store = mockStore({
|
|
14
|
+
userSession: {
|
|
15
|
+
token: null,
|
|
16
|
+
},
|
|
17
|
+
intl: {
|
|
18
|
+
locale: 'en',
|
|
19
|
+
messages: {},
|
|
20
|
+
},
|
|
21
|
+
apierror: {
|
|
22
|
+
message: 'You are not authorized to access this resource',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const component = renderer.create(
|
|
26
|
+
<Provider store={store}>
|
|
27
|
+
<MemoryRouter>
|
|
28
|
+
<Unauthorized />
|
|
29
|
+
</MemoryRouter>
|
|
30
|
+
</Provider>,
|
|
31
|
+
);
|
|
32
|
+
const json = component.toJSON();
|
|
33
|
+
expect(json).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('renders an unauthorized component for authenticated user', () => {
|
|
37
|
+
const store = mockStore({
|
|
38
|
+
userSession: {
|
|
39
|
+
token: '1234',
|
|
40
|
+
},
|
|
14
41
|
intl: {
|
|
15
42
|
locale: 'en',
|
|
16
43
|
messages: {},
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import EventViewComponent from './EventView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
import config from '@plone/volto/registry';
|
|
6
|
+
const IntlEventViewComponent = injectIntl(EventViewComponent);
|
|
7
|
+
const { settings } = config;
|
|
8
|
+
|
|
9
|
+
function StoryComponent(args) {
|
|
10
|
+
return (
|
|
11
|
+
<Wrapper
|
|
12
|
+
customStore={{
|
|
13
|
+
intl: {
|
|
14
|
+
locale: 'en',
|
|
15
|
+
messages: {},
|
|
16
|
+
},
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
20
|
+
<IntlEventViewComponent
|
|
21
|
+
content={{
|
|
22
|
+
'@id': 'http://localhost:8080/Plone/my-page',
|
|
23
|
+
...args,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</Wrapper>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Default = StoryComponent.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
title: 'Hello World!',
|
|
33
|
+
end: '2019-06-23T16:20:00+00:00',
|
|
34
|
+
start: '2019-06-23T15:20:00+00:00',
|
|
35
|
+
attendees: [],
|
|
36
|
+
subjects: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const EventViewAllProps = StoryComponent.bind({});
|
|
40
|
+
EventViewAllProps.args = {
|
|
41
|
+
title: 'Hello World!',
|
|
42
|
+
description: 'Hi',
|
|
43
|
+
text: {
|
|
44
|
+
data: '<p>Hello World!</p>',
|
|
45
|
+
},
|
|
46
|
+
attendees: ['John Doe', 'Mario Rossi'],
|
|
47
|
+
contact_email: 'test@example.com',
|
|
48
|
+
contact_name: 'John Doe',
|
|
49
|
+
contact_phone: '0123456789',
|
|
50
|
+
end: '2019-06-24T15:20:00+00:00',
|
|
51
|
+
event_url: 'https://www.example.com',
|
|
52
|
+
location: 'Volto, Plone',
|
|
53
|
+
open_end: false,
|
|
54
|
+
recurrence: 'RRULE:FREQ=DAILY;INTERVAL=7;COUNT=7',
|
|
55
|
+
start: '2019-06-23T15:20:00+00:00',
|
|
56
|
+
subjects: ['Guillotina', 'Volto'],
|
|
57
|
+
whole_day: false,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const EventViewWithoutLinkToApiInTheText = StoryComponent.bind({});
|
|
61
|
+
EventViewWithoutLinkToApiInTheText.args = {
|
|
62
|
+
title: 'Hello World!',
|
|
63
|
+
attendees: [],
|
|
64
|
+
end: '2019-06-23T16:20:00+00:00',
|
|
65
|
+
start: '2019-06-23T15:20:00+00:00',
|
|
66
|
+
subjects: [],
|
|
67
|
+
text: {
|
|
68
|
+
data: `<p>Hello World!</p><p>This is an <a href="${settings.apiPath}/foo/bar">internal link</a> and a <a href="${settings.apiPath}/foo/baz">second link</a></p>`,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export default {
|
|
72
|
+
title: 'Public components/View/EventView',
|
|
73
|
+
component: EventViewComponent,
|
|
74
|
+
decorators: [
|
|
75
|
+
(Story) => (
|
|
76
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
77
|
+
<Story />
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
],
|
|
81
|
+
argTypes: {
|
|
82
|
+
end: {
|
|
83
|
+
control: 'date',
|
|
84
|
+
},
|
|
85
|
+
start: {
|
|
86
|
+
control: 'date',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import FileViewComponent from './FileView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlFileViewComponent = injectIntl(FileViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper customStore={{}}>
|
|
11
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
12
|
+
<IntlFileViewComponent
|
|
13
|
+
content={{
|
|
14
|
+
...args,
|
|
15
|
+
file: {
|
|
16
|
+
download: 'file:///preview.pdf',
|
|
17
|
+
...args,
|
|
18
|
+
},
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
</Wrapper>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Default = StoryComponent.bind({});
|
|
26
|
+
Default.args = {
|
|
27
|
+
title: 'Hello World!',
|
|
28
|
+
description: 'Hi',
|
|
29
|
+
filename: 'preview.pdf',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
title: 'Public components/View/FileView',
|
|
34
|
+
component: FileViewComponent,
|
|
35
|
+
decorators: [
|
|
36
|
+
(Story) => (
|
|
37
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
38
|
+
<Story />
|
|
39
|
+
</div>
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
argTypes: {
|
|
43
|
+
title: {
|
|
44
|
+
description: 'Title of the component',
|
|
45
|
+
},
|
|
46
|
+
filename: {
|
|
47
|
+
description: 'Name of the file',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import LinkViewComponent from './LinkView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlLinkViewComponent = injectIntl(LinkViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
userSession: {
|
|
13
|
+
token: null,
|
|
14
|
+
},
|
|
15
|
+
intl: {
|
|
16
|
+
locale: 'en',
|
|
17
|
+
messages: {},
|
|
18
|
+
},
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
22
|
+
<IntlLinkViewComponent
|
|
23
|
+
token="1234"
|
|
24
|
+
content={{
|
|
25
|
+
...args,
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</Wrapper>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const Default = StoryComponent.bind({});
|
|
33
|
+
Default.args = {
|
|
34
|
+
title: 'Hello World!',
|
|
35
|
+
description: 'Hi',
|
|
36
|
+
remoteUrl: '/news',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
title: 'Public components/View/LinkView',
|
|
41
|
+
component: LinkViewComponent,
|
|
42
|
+
decorators: [
|
|
43
|
+
(Story) => (
|
|
44
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
45
|
+
<Story />
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
],
|
|
49
|
+
argTypes: {
|
|
50
|
+
title: {
|
|
51
|
+
description: 'Title of the component',
|
|
52
|
+
},
|
|
53
|
+
remoteUrl: {
|
|
54
|
+
description: 'remoteUrl mentioned in the page',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ListingViewComponent from './ListingView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlListingViewComponent = injectIntl(ListingViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
intl: {
|
|
13
|
+
locale: 'en',
|
|
14
|
+
messages: {},
|
|
15
|
+
},
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
19
|
+
<IntlListingViewComponent
|
|
20
|
+
content={{
|
|
21
|
+
title: 'Hello World!',
|
|
22
|
+
description: 'Hi',
|
|
23
|
+
...args,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</Wrapper>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Default = StoryComponent.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
items: [
|
|
33
|
+
{
|
|
34
|
+
title: 'My item',
|
|
35
|
+
description: 'My item description',
|
|
36
|
+
url: '/item',
|
|
37
|
+
'@type': 'Document',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Second item',
|
|
41
|
+
description: 'My second item description',
|
|
42
|
+
url: '/item2',
|
|
43
|
+
'@type': 'Document',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
title: 'Public components/View/ListingView',
|
|
50
|
+
component: ListingViewComponent,
|
|
51
|
+
decorators: [
|
|
52
|
+
(Story) => (
|
|
53
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
54
|
+
<Story />
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
],
|
|
58
|
+
argTypes: {
|
|
59
|
+
items: {
|
|
60
|
+
control: 'object',
|
|
61
|
+
description: 'Listed pages',
|
|
62
|
+
},
|
|
63
|
+
title: {
|
|
64
|
+
description: 'Title of the page listed',
|
|
65
|
+
},
|
|
66
|
+
description: {
|
|
67
|
+
description: 'Description of the page',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import NewsItemViewComponent from './NewsItemView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlNewsItemViewComponent = injectIntl(NewsItemViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
intl: {
|
|
13
|
+
locale: 'en',
|
|
14
|
+
messages: {},
|
|
15
|
+
},
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
19
|
+
<IntlNewsItemViewComponent
|
|
20
|
+
content={{
|
|
21
|
+
...args,
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
</Wrapper>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Default = StoryComponent.bind({});
|
|
29
|
+
Default.args = {
|
|
30
|
+
title: 'Hello World!',
|
|
31
|
+
description: 'Hi',
|
|
32
|
+
text: {
|
|
33
|
+
data: '<p>Hello World!</p>',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
title: 'Public components/View/NewsItemView',
|
|
39
|
+
component: NewsItemViewComponent,
|
|
40
|
+
decorators: [
|
|
41
|
+
(Story) => (
|
|
42
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
43
|
+
<Story />
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
],
|
|
47
|
+
argTypes: {
|
|
48
|
+
title: {
|
|
49
|
+
description: 'Title of the page listed',
|
|
50
|
+
},
|
|
51
|
+
description: {
|
|
52
|
+
description: 'Description of the page',
|
|
53
|
+
},
|
|
54
|
+
text: {
|
|
55
|
+
description: 'Content',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import RenderBlocksComponent from './RenderBlocks';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
import config from '@plone/volto/registry';
|
|
7
|
+
|
|
8
|
+
const IntlRenderBlocksComponent = injectIntl(RenderBlocksComponent);
|
|
9
|
+
|
|
10
|
+
function StoryComponent(args) {
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper
|
|
13
|
+
customStore={{
|
|
14
|
+
intl: {
|
|
15
|
+
locale: 'en',
|
|
16
|
+
messages: {},
|
|
17
|
+
},
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
21
|
+
<IntlRenderBlocksComponent
|
|
22
|
+
blocksConfig={{
|
|
23
|
+
...config.blocks.blocksConfig,
|
|
24
|
+
custom: {
|
|
25
|
+
id: 'custom',
|
|
26
|
+
...args,
|
|
27
|
+
},
|
|
28
|
+
}}
|
|
29
|
+
content={{
|
|
30
|
+
blocks_layout: {
|
|
31
|
+
items: ['a', 'b'],
|
|
32
|
+
},
|
|
33
|
+
...args,
|
|
34
|
+
}}
|
|
35
|
+
path="/foo"
|
|
36
|
+
/>
|
|
37
|
+
</Wrapper>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Default = StoryComponent.bind({});
|
|
42
|
+
Default.args = {
|
|
43
|
+
view: ({ id, data }) => (
|
|
44
|
+
<div>
|
|
45
|
+
{id} - {data.text}
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
blocks: {
|
|
49
|
+
a: {
|
|
50
|
+
'@type': 'custom',
|
|
51
|
+
text: 'a',
|
|
52
|
+
},
|
|
53
|
+
b: {
|
|
54
|
+
'@type': 'custom',
|
|
55
|
+
text: 'b',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export const PathToBlocks = StoryComponent.bind({});
|
|
60
|
+
PathToBlocks.args = {
|
|
61
|
+
view: ({ id, data, path }) => (
|
|
62
|
+
<div>
|
|
63
|
+
id: {id} - text: {data.text} - path: {path}
|
|
64
|
+
</div>
|
|
65
|
+
),
|
|
66
|
+
|
|
67
|
+
blocks: {
|
|
68
|
+
a: {
|
|
69
|
+
'@type': 'custom',
|
|
70
|
+
text: 'bar',
|
|
71
|
+
},
|
|
72
|
+
b: {
|
|
73
|
+
'@type': 'custom',
|
|
74
|
+
text: 'foo',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const InvalidBlocks = StoryComponent.bind({});
|
|
80
|
+
InvalidBlocks.args = {
|
|
81
|
+
blocks_layout: {
|
|
82
|
+
items: ['MISSING-YOU-1', 'a', 'MISSING-YOU-2'],
|
|
83
|
+
},
|
|
84
|
+
blocks: {
|
|
85
|
+
a: {
|
|
86
|
+
'@type': 'custom',
|
|
87
|
+
text: 'bar',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export default {
|
|
92
|
+
title: 'Internal components/View/RenderBlocks',
|
|
93
|
+
component: RenderBlocksComponent,
|
|
94
|
+
decorators: [
|
|
95
|
+
(Story) => (
|
|
96
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
97
|
+
<Story />
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
],
|
|
101
|
+
argTypes: {
|
|
102
|
+
view: {
|
|
103
|
+
description: 'Pattern in which to place block content',
|
|
104
|
+
},
|
|
105
|
+
blocks: {
|
|
106
|
+
description: 'blocks in the page',
|
|
107
|
+
},
|
|
108
|
+
blocks_layout: {
|
|
109
|
+
description: 'block layout in the page',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import SummaryViewComponent from './SummaryView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlSummaryViewComponent = injectIntl(SummaryViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
intl: {
|
|
13
|
+
locale: 'en',
|
|
14
|
+
messages: {},
|
|
15
|
+
},
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
19
|
+
<IntlSummaryViewComponent
|
|
20
|
+
content={{
|
|
21
|
+
...args,
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
</Wrapper>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Default = StoryComponent.bind({});
|
|
29
|
+
Default.args = {
|
|
30
|
+
title: 'Hello World!',
|
|
31
|
+
description: 'Hi',
|
|
32
|
+
items: [
|
|
33
|
+
{
|
|
34
|
+
title: 'My item',
|
|
35
|
+
description: 'My item description',
|
|
36
|
+
url: '/item',
|
|
37
|
+
image: {
|
|
38
|
+
scales: {
|
|
39
|
+
thumb: {
|
|
40
|
+
download: 'file:///preview.jpg',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
image_caption: 'My image caption',
|
|
45
|
+
'@type': 'News Item',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
export default {
|
|
50
|
+
title: 'Public components/View/SummaryView',
|
|
51
|
+
component: SummaryViewComponent,
|
|
52
|
+
decorators: [
|
|
53
|
+
(Story) => (
|
|
54
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
55
|
+
<Story />
|
|
56
|
+
</div>
|
|
57
|
+
),
|
|
58
|
+
],
|
|
59
|
+
|
|
60
|
+
argTypes: {
|
|
61
|
+
title: {
|
|
62
|
+
description: 'Title of the page listed',
|
|
63
|
+
},
|
|
64
|
+
description: {
|
|
65
|
+
description: 'Description of the page',
|
|
66
|
+
},
|
|
67
|
+
items: {
|
|
68
|
+
description: 'Content in the page',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|