mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-03-19 15:01:06 +08:00
feat: Pass components to blocks in server, setup Icon.
This commit is contained in:
parent
739704496d
commit
7db2640974
25
.pnp.cjs
generated
25
.pnp.cjs
generated
@ -5747,7 +5747,8 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["next-auth", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.0.0-beta.6"],
|
||||
["next-with-less", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:2.0.2"],
|
||||
["react", "npm:18.0.0-alpha-327d5c484-20211106"],
|
||||
["react-dom", "virtual:04055f037dce009b6d437327a3df2c0a05f0436e14e2b705672dd0d1e0a3dfd29d8d62e0db8cb7e152c4b95e36ad3ccd6a68c9e962121dec9e597b25e0481519#npm:18.0.0-alpha-327d5c484-20211106"]
|
||||
["react-dom", "virtual:04055f037dce009b6d437327a3df2c0a05f0436e14e2b705672dd0d1e0a3dfd29d8d62e0db8cb7e152c4b95e36ad3ccd6a68c9e962121dec9e597b25e0481519#npm:18.0.0-alpha-327d5c484-20211106"],
|
||||
["react-icons", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.3.1"]
|
||||
],
|
||||
"linkType": "SOFT",
|
||||
}]
|
||||
@ -22628,6 +22629,28 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD",
|
||||
}]
|
||||
]],
|
||||
["react-icons", [
|
||||
["npm:4.3.1", {
|
||||
"packageLocation": "./.yarn/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip/node_modules/react-icons/",
|
||||
"packageDependencies": [
|
||||
["react-icons", "npm:4.3.1"]
|
||||
],
|
||||
"linkType": "SOFT",
|
||||
}],
|
||||
["virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.3.1", {
|
||||
"packageLocation": "./.yarn/__virtual__/react-icons-virtual-0dd268c70d/0/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip/node_modules/react-icons/",
|
||||
"packageDependencies": [
|
||||
["react-icons", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.3.1"],
|
||||
["@types/react", null],
|
||||
["react", "npm:18.0.0-alpha-327d5c484-20211106"]
|
||||
],
|
||||
"packagePeers": [
|
||||
"@types/react",
|
||||
"react"
|
||||
],
|
||||
"linkType": "HARD",
|
||||
}]
|
||||
]],
|
||||
["react-is", [
|
||||
["npm:16.13.1", {
|
||||
"packageLocation": "./.yarn/cache/react-is-npm-16.13.1-a9b9382b4f-f7a19ac349.zip/node_modules/react-is/",
|
||||
|
BIN
.yarn/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip
vendored
Normal file
BIN
.yarn/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip
vendored
Normal file
Binary file not shown.
@ -18,6 +18,7 @@ export { default as Anchor } from './blocks/Anchor/Anchor.js';
|
||||
export { default as Box } from './blocks/Box/Box.js';
|
||||
export { default as DangerousHtml } from './blocks/DangerousHtml/DangerousHtml.js';
|
||||
export { default as Html } from './blocks/Html/Html.js';
|
||||
export { default as Icon } from './blocks/Icon/Icon.js';
|
||||
export { default as Img } from './blocks/Img/Img.js';
|
||||
export { default as List } from './blocks/List/List.js';
|
||||
export { default as Span } from './blocks/Span/Span.js';
|
||||
|
@ -47,7 +47,8 @@
|
||||
"next": "12.0.3",
|
||||
"next-auth": "4.0.0-beta.6",
|
||||
"react": "18.0.0-alpha-327d5c484-20211106",
|
||||
"react-dom": "18.0.0-alpha-327d5c484-20211106"
|
||||
"react-dom": "18.0.0-alpha-327d5c484-20211106",
|
||||
"react-icons": "4.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/eslint-plugin-next": "12.0.2",
|
||||
|
@ -65,8 +65,9 @@ const CategorySwitch = ({ block, Blocks, context, lowdefy }) => {
|
||||
triggerEvent: block.triggerEvent,
|
||||
})}
|
||||
// TODO: React throws a basePath warning
|
||||
basePath={lowdefy.basePath}
|
||||
basePath={lowdefy._internal.basePath}
|
||||
blockId={block.blockId}
|
||||
components={lowdefy._internal.components}
|
||||
events={block.eval.events}
|
||||
homePageId={lowdefy.homePageId}
|
||||
key={block.blockId}
|
||||
@ -97,8 +98,9 @@ const CategorySwitch = ({ block, Blocks, context, lowdefy }) => {
|
||||
registerMethod: block.registerMethod,
|
||||
triggerEvent: block.triggerEvent,
|
||||
})}
|
||||
basePath={lowdefy.basePath}
|
||||
basePath={lowdefy._internal.basePath}
|
||||
blockId={block.blockId}
|
||||
components={lowdefy._internal.components}
|
||||
events={block.eval.events}
|
||||
homePageId={lowdefy.homePageId}
|
||||
key={block.blockId}
|
||||
|
@ -65,8 +65,9 @@ const Container = ({ block, Blocks, Component, context, lowdefy }) => {
|
||||
registerMethod: block.registerMethod,
|
||||
triggerEvent: block.triggerEvent,
|
||||
})}
|
||||
basePath={lowdefy.basePath}
|
||||
basePath={lowdefy._internal.basePath}
|
||||
blockId={block.blockId}
|
||||
components={lowdefy._internal.components}
|
||||
content={content}
|
||||
events={block.eval.events}
|
||||
homePageId={lowdefy.homePageId}
|
||||
|
@ -72,8 +72,9 @@ const List = ({ block, Blocks, Component, context, lowdefy }) => {
|
||||
triggerEvent: block.triggerEvent,
|
||||
unshiftItem: block.unshiftItem,
|
||||
})}
|
||||
basePath={lowdefy.basePath}
|
||||
basePath={lowdefy._internal.basePath}
|
||||
blockId={block.blockId}
|
||||
components={lowdefy._internal.components}
|
||||
events={block.eval.events}
|
||||
homePageId={lowdefy.homePageId}
|
||||
key={block.blockId}
|
||||
|
@ -15,7 +15,11 @@
|
||||
*/
|
||||
|
||||
import Link from 'next/link';
|
||||
import { createIcon } from '@lowdefy/block-utils';
|
||||
|
||||
import icons from '../plugins/icons.js';
|
||||
|
||||
export default {
|
||||
Link,
|
||||
Icon: createIcon(icons),
|
||||
};
|
||||
|
@ -19,9 +19,11 @@
|
||||
import { Anchor } from '@lowdefy/blocks-basic/blocks.js';
|
||||
import { Box } from '@lowdefy/blocks-basic/blocks.js';
|
||||
import { Html } from '@lowdefy/blocks-basic/blocks.js';
|
||||
import { Icon } from '@lowdefy/blocks-basic/blocks.js';
|
||||
|
||||
export default {
|
||||
Anchor,
|
||||
Box,
|
||||
Html,
|
||||
Icon,
|
||||
};
|
||||
|
35
packages/server/src/plugins/icons.js
Normal file
35
packages/server/src/plugins/icons.js
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright 2020-2021 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.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-duplicates */
|
||||
|
||||
import { AiOutlineFire } from 'react-icons/ai';
|
||||
import { AiOutlineRocket } from 'react-icons/ai';
|
||||
import { AiOutlineLoading3Quarters } from 'react-icons/ai';
|
||||
import { AiOutlineExclamationCircle } from 'react-icons/ai';
|
||||
import { AiOutlineExperiment } from 'react-icons/ai';
|
||||
import { FcLandscape } from 'react-icons/fc';
|
||||
import { MdIcecream } from 'react-icons/md';
|
||||
|
||||
export default {
|
||||
AiOutlineLoading3Quarters,
|
||||
AiOutlineExclamationCircle,
|
||||
AiOutlineFire,
|
||||
AiOutlineRocket,
|
||||
AiOutlineExperiment,
|
||||
FcLandscape,
|
||||
MdIcecream,
|
||||
};
|
10
yarn.lock
10
yarn.lock
@ -3959,6 +3959,7 @@ __metadata:
|
||||
next-with-less: 2.0.2
|
||||
react: 18.0.0-alpha-327d5c484-20211106
|
||||
react-dom: 18.0.0-alpha-327d5c484-20211106
|
||||
react-icons: 4.3.1
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -17764,6 +17765,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"react-icons@npm:4.3.1":
|
||||
version: 4.3.1
|
||||
resolution: "react-icons@npm:4.3.1"
|
||||
peerDependencies:
|
||||
react: "*"
|
||||
checksum: 2cc608acdd3e906aa3aaee290b8398220639677c949382d86e554020e5dab6a9f1ed7484418aa5272cb5c5c018e1fc9a323d433d901697a76530029f9ecb1263
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"react-is@npm:17.0.2, react-is@npm:^17.0.1":
|
||||
version: 17.0.2
|
||||
resolution: "react-is@npm:17.0.2"
|
||||
|
Loading…
x
Reference in New Issue
Block a user