diff --git a/.pnp.cjs b/.pnp.cjs index e93cae06f..c4b2933f8 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -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/", diff --git a/.yarn/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip b/.yarn/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip new file mode 100644 index 000000000..fcc5d0af9 Binary files /dev/null and b/.yarn/cache/react-icons-npm-4.3.1-46cb955834-2cc608acdd.zip differ diff --git a/packages/plugins/blocks/blocks-basic/src/blocks.js b/packages/plugins/blocks/blocks-basic/src/blocks.js index 7dd204f30..7d571b68d 100644 --- a/packages/plugins/blocks/blocks-basic/src/blocks.js +++ b/packages/plugins/blocks/blocks-basic/src/blocks.js @@ -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'; diff --git a/packages/server/package.json b/packages/server/package.json index ad323c2a4..6de62a8e1 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -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", diff --git a/packages/server/src/components/block/CategorySwitch.js b/packages/server/src/components/block/CategorySwitch.js index a85c3174d..d976b64b5 100644 --- a/packages/server/src/components/block/CategorySwitch.js +++ b/packages/server/src/components/block/CategorySwitch.js @@ -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} diff --git a/packages/server/src/components/block/Container.js b/packages/server/src/components/block/Container.js index 0b72348f2..0ceede5aa 100644 --- a/packages/server/src/components/block/Container.js +++ b/packages/server/src/components/block/Container.js @@ -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} diff --git a/packages/server/src/components/block/List.js b/packages/server/src/components/block/List.js index 89c129547..ea383ee01 100644 --- a/packages/server/src/components/block/List.js +++ b/packages/server/src/components/block/List.js @@ -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} diff --git a/packages/server/src/components/components.js b/packages/server/src/components/components.js index 007c3a246..65ff9444e 100644 --- a/packages/server/src/components/components.js +++ b/packages/server/src/components/components.js @@ -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), }; diff --git a/packages/server/src/plugins/blocks.js b/packages/server/src/plugins/blocks.js index fcbddc63c..2e1513d47 100644 --- a/packages/server/src/plugins/blocks.js +++ b/packages/server/src/plugins/blocks.js @@ -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, }; diff --git a/packages/server/src/plugins/icons.js b/packages/server/src/plugins/icons.js new file mode 100644 index 000000000..d76d9f0c4 --- /dev/null +++ b/packages/server/src/plugins/icons.js @@ -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, +}; diff --git a/yarn.lock b/yarn.lock index e3f401e42..744e6a777 100644 --- a/yarn.lock +++ b/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"