From 7300e49ad94b80abf4aa9453ac5743c27065db44 Mon Sep 17 00:00:00 2001 From: Gervwyk Date: Tue, 24 Nov 2020 18:35:51 +0200 Subject: [PATCH] fix(blocksAntd): remove Timeline and UserAvatar files --- .../blocksAntd/demo/examples/Timeline.yaml | 8 -- .../blocksAntd/demo/examples/UserAvatar.yaml | 6 - .../src/blocks/Timeline/Timeline.js | 75 ------------ .../src/blocks/Timeline/Timeline.json | 59 --------- .../src/blocks/UserAvatar/UserAvatar.js | 114 ------------------ .../src/blocks/UserAvatar/UserAvatar.json | 59 --------- .../blocks/blocksAntd/tests/Timeline.test.js | 24 ---- .../blocksAntd/tests/UserAvatar.test.js | 24 ---- .../tests/__snapshots__/Timeline.test.js.snap | 35 ------ .../__snapshots__/UserAvatar.test.js.snap | 87 ------------- 10 files changed, 491 deletions(-) delete mode 100644 packages/blocks/blocksAntd/demo/examples/Timeline.yaml delete mode 100644 packages/blocks/blocksAntd/demo/examples/UserAvatar.yaml delete mode 100644 packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.js delete mode 100644 packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.json delete mode 100644 packages/blocks/blocksAntd/src/blocks/UserAvatar/UserAvatar.js delete mode 100644 packages/blocks/blocksAntd/src/blocks/UserAvatar/UserAvatar.json delete mode 100644 packages/blocks/blocksAntd/tests/Timeline.test.js delete mode 100644 packages/blocks/blocksAntd/tests/UserAvatar.test.js delete mode 100644 packages/blocks/blocksAntd/tests/__snapshots__/Timeline.test.js.snap delete mode 100644 packages/blocks/blocksAntd/tests/__snapshots__/UserAvatar.test.js.snap diff --git a/packages/blocks/blocksAntd/demo/examples/Timeline.yaml b/packages/blocks/blocksAntd/demo/examples/Timeline.yaml deleted file mode 100644 index 75956c12a..000000000 --- a/packages/blocks/blocksAntd/demo/examples/Timeline.yaml +++ /dev/null @@ -1,8 +0,0 @@ -- id: default - type: Timeline -- id: properties.items - type: Timeline - properties: - items: - - title: one - - title: two \ No newline at end of file diff --git a/packages/blocks/blocksAntd/demo/examples/UserAvatar.yaml b/packages/blocks/blocksAntd/demo/examples/UserAvatar.yaml deleted file mode 100644 index 43c62708a..000000000 --- a/packages/blocks/blocksAntd/demo/examples/UserAvatar.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- id: default - type: UserAvatar -- id: properties.name - type: UserAvatar - properties: - name: Avatar name \ No newline at end of file diff --git a/packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.js b/packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.js deleted file mode 100644 index 4e1042303..000000000 --- a/packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright 2020 Lowdefy, Inc - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -import React from 'react'; -import { Timeline } from 'antd'; -import { blockDefaultProps } from '@lowdefy/block-tools'; -import { get, mergeObjects, serializer, type } from '@lowdefy/helpers'; - -import Icon from '../Icon/Icon'; - -const TimelineBlock = ({ blockId, list, methods, properties }) => { - const other = {}; - if (properties.mode) { - other.mode = properties.mode; - } - return ( - - ) - } - reverse={properties.reverse} - {...other} - > - {(list || []).map((child, i) => { - let icon = serializer.copy(get(properties, `data.${i}.${properties.iconField || 'icon'}`)); - let styleDot = get(properties, `data.${i}.${properties.iconField || 'style'}`); - if (type.isString(icon)) { - icon = { name: icon }; - } - if (!type.isObject(styleDot)) { - styleDot = {}; - } - return ( - - ) - } - > - {child.content && child.content()} - - ); - })} - - ); -}; - -TimelineBlock.defaultProps = blockDefaultProps; - -export default TimelineBlock; diff --git a/packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.json b/packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.json deleted file mode 100644 index 016b7a59c..000000000 --- a/packages/blocks/blocksAntd/src/blocks/Timeline/Timeline.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "category": "list", - "loading": false, - "schema": { - "properties": { - "type": "object", - "additionalProperties": false, - "properties": { - "style": { - "type": "object", - "description": "Css style object to apply to timeline." - }, - "pendingDotIcon": { - "type": ["object", "string"], - "description": "Set the dot of the last ghost node when pending is true." - }, - "pending": { - "type": "boolean", - "description": "Set the last ghost node's existence or its content." - }, - "reverse": { - "type": "boolean", - "description": "Reverse timeline nodes." - }, - "mode": { - "type": "string", - "enum": ["left", "right", "alternate"], - "description": "By sending alternate the timeline will distribute the nodes to the left and right." - }, - "data": { - "type": "array", - "description": "Timeline items.", - "items": { - "type": "object", - "properties": { - "color": { - "type": "string", - "description": "Customize dot color." - }, - "position": { - "type": "string", - "enum": ["left", "right"], - "description": "Customize node position." - }, - "label": { - "type": "string", - "description": "Set the label." - }, - "iconField": { - "type": ["string", "object"], - "description": "Name of an Ant Design Icon or properties of an Icon block to customize the item timeline icon." - } - } - } - } - } - } - } -} diff --git a/packages/blocks/blocksAntd/src/blocks/UserAvatar/UserAvatar.js b/packages/blocks/blocksAntd/src/blocks/UserAvatar/UserAvatar.js deleted file mode 100644 index 01ec9345e..000000000 --- a/packages/blocks/blocksAntd/src/blocks/UserAvatar/UserAvatar.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright 2020 Lowdefy, Inc - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -import React, { useEffect } from 'react'; -import { mergeObjects } from '@lowdefy/helpers'; -import { blockDefaultProps } from '@lowdefy/block-tools'; - -import Avatar from '../Avatar/Avatar'; -import Button from '../Button/Button'; - -const UserAvatar = ({ blockId, methods, properties, user }) => { - useEffect(() => { - methods.registerAction('onBlockLogin', [ - { - id: 'login', - type: 'Login', - }, - ]); - methods.registerAction('onBlockAvatar', [ - { - id: 'profileClick', - type: 'Link', - params: { pageId: 'profile' }, - }, - ]); - }, []); - if (properties.disabled) { - return ''; - } - if (!user.name || properties.loggedIn === false) { - return ( - -`; - -exports[`Render properties.name 1`] = ` - -`; - -exports[`Test Schema default 1`] = `true`; - -exports[`Test Schema default 2`] = `null`; - -exports[`Test Schema properties.name 1`] = `true`; - -exports[`Test Schema properties.name 2`] = `null`;