From 19f21b44f7f98041aa2806c1e2d4f47561038344 Mon Sep 17 00:00:00 2001 From: Malavika Koppula Date: Thu, 3 Aug 2023 14:54:30 -0400 Subject: [PATCH 1/4] Added textfile block --- blocks/textfile-block/CHANGELOG.md | 4 ++++ .../textfile-block/features/textfile/text.js | 19 +++++++++++++++++++ .../features/textfile/text.test.js | 17 +++++++++++++++++ blocks/textfile-block/jest.config.js | 5 +++++ 4 files changed, 45 insertions(+) create mode 100644 blocks/textfile-block/CHANGELOG.md create mode 100644 blocks/textfile-block/features/textfile/text.js create mode 100644 blocks/textfile-block/features/textfile/text.test.js create mode 100644 blocks/textfile-block/jest.config.js diff --git a/blocks/textfile-block/CHANGELOG.md b/blocks/textfile-block/CHANGELOG.md new file mode 100644 index 00000000..e9fb6ecf --- /dev/null +++ b/blocks/textfile-block/CHANGELOG.md @@ -0,0 +1,4 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. \ No newline at end of file diff --git a/blocks/textfile-block/features/textfile/text.js b/blocks/textfile-block/features/textfile/text.js new file mode 100644 index 00000000..f396b734 --- /dev/null +++ b/blocks/textfile-block/features/textfile/text.js @@ -0,0 +1,19 @@ +import PropTypes from 'fusion:prop-types' +import Consumer from 'fusion:consumer' + +export function Textfile({ customFields }){ + const { Text = "" } = customFields || {}; + return Text; +}; + +Textfile.label = "Text File – Arc Block"; + +Textfile.icon = "notes-paper-text"; + +Textfile.propTypes = { + customFields: PropTypes.shape({ + // eslint-disable-next-line react/no-typos + Text: PropTypes.richtext, + }), +} +export default Consumer(Textfile) diff --git a/blocks/textfile-block/features/textfile/text.test.js b/blocks/textfile-block/features/textfile/text.test.js new file mode 100644 index 00000000..f67390e6 --- /dev/null +++ b/blocks/textfile-block/features/textfile/text.test.js @@ -0,0 +1,17 @@ +import TextFile from "./text"; + +const simple = "User-agent: *\nAllow: /\n\nSitemap: http://www.example.com/sitemap.xml"; + +it('should render the simple text', () => { + const textFile = TextFile({ + customFields: { + Text: simple + }, + }) + expect(textFile).toMatchSnapshot() +}) + +it('should not render anything when no data is given', () => { + const textFile = TextFile({}) + expect(textFile).toMatchSnapshot() +}) diff --git a/blocks/textfile-block/jest.config.js b/blocks/textfile-block/jest.config.js new file mode 100644 index 00000000..063a34cb --- /dev/null +++ b/blocks/textfile-block/jest.config.js @@ -0,0 +1,5 @@ +const base = require("../../jest/jest.config.base"); + +module.exports = { + ...base, +}; From ca9ee7dc729556e570ffef9867862715705141af Mon Sep 17 00:00:00 2001 From: malavikakoppula <83021791+malavikakoppula@users.noreply.github.com> Date: Mon, 7 Aug 2023 12:41:46 -0400 Subject: [PATCH 2/4] Create soft-jeans-listen.md --- .changeset/soft-jeans-listen.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/soft-jeans-listen.md diff --git a/.changeset/soft-jeans-listen.md b/.changeset/soft-jeans-listen.md new file mode 100644 index 00000000..3032e324 --- /dev/null +++ b/.changeset/soft-jeans-listen.md @@ -0,0 +1,5 @@ +--- + +--- + +Added textfile block From d30281f309fac2953a65f541d6fac87a85cc577e Mon Sep 17 00:00:00 2001 From: Malavika Koppula Date: Mon, 7 Aug 2023 12:47:36 -0400 Subject: [PATCH 3/4] Added package to textfile-block --- blocks/textfile-block/package.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 blocks/textfile-block/package.json diff --git a/blocks/textfile-block/package.json b/blocks/textfile-block/package.json new file mode 100644 index 00000000..e1e0c0c4 --- /dev/null +++ b/blocks/textfile-block/package.json @@ -0,0 +1,27 @@ +{ + "name": "@wpmedia/textfile-block", + "version": "0.0.1", + "description": "Fusion News Theme text file block", + "license": "CC-BY-NC-ND-4.0", + "main": "index.js", + "files": [ + "features" + ], + "publishConfig": { + "registry": "https://npm.pkg.github.com/", + "access": "public" + }, + "repository": { + "type": "git", + "url": "ssh://git@github.com/WPMedia/feed-components.git", + "directory": "blocks/textfile-block" + }, + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1", + "lint": "eslint --ext js --ext jsx features" + }, + "devDependencies": { + "prop-types": "^15.7.2" + }, + "gitHead": "83fb8d6685958d85ddbfcfbf01d9a5c864cd6c95" +} From 67d8c3cf7de550443bd505097b09ae6513c8a813 Mon Sep 17 00:00:00 2001 From: Malavika Koppula Date: Mon, 7 Aug 2023 12:50:04 -0400 Subject: [PATCH 4/4] added package-lock --- blocks/textfile-block/package-lock.json | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 blocks/textfile-block/package-lock.json diff --git a/blocks/textfile-block/package-lock.json b/blocks/textfile-block/package-lock.json new file mode 100644 index 00000000..852102e9 --- /dev/null +++ b/blocks/textfile-block/package-lock.json @@ -0,0 +1,46 @@ +{ + "name": "@wpmedia/textfile-block", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true + }, + "prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + } + } +}