diff --git a/.all-contributorsrc b/.all-contributorsrc deleted file mode 100644 index 55e53bd..0000000 --- a/.all-contributorsrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "projectName": "learnblocks", - "projectOwner": "learnblocks", - "repoType": "github", - "repoHost": "https://github.com", - "files": [ - "README.md" - ], - "imageSize": 64, - "commit": true, - "commitConvention": "angular", - "contributors": [], - "contributorsPerLine": 7, - "skipCi": true -} diff --git a/.all-membersrc b/.all-membersrc deleted file mode 100644 index 1588945..0000000 --- a/.all-membersrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "members": [] -} \ No newline at end of file diff --git a/.all-sponsorsrc b/.all-sponsorsrc deleted file mode 100644 index 4706225..0000000 --- a/.all-sponsorsrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "individuals": [], - "companies": [] -} \ No newline at end of file diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..abba0f4 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,19 @@ +name: Publish on NPM + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: "12.x" + registry-url: "https://registry.npmjs.org" + - run: npm install + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index d4e7a53..0263dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,24 +4,24 @@ # website public/ folder (temporary; copied to root for docs:build and vercel compat) # public/ +/dist node_modules/ -lerna-debug.log npm-debug.log -packages/*/lib -packages/*/.next +/*/lib +/*/.next storybook-static -packages/*/coverage -packages/*/dist +/*/coverage +/*/dist tooling/*/dist -packages/*/node_modules +/*/node_modules npm-debug.log* -packages/*/.env +/*/.env *.log *.cache yarn-error.log -packages/*/.rpt2_cache -packages/*/.rts2_cache* -packages/*/tsconfig.tsbuildinfo +/*/.rpt2_cache +/*/.rts2_cache* +/*/tsconfig.tsbuildinfo tsconfig.tsbuildinfo .next .idea diff --git a/.lintstagedrc b/.lintstagedrc index 67d9ddf..a93d95b 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -5,4 +5,4 @@ "**/*.{md,yml,json,babelrc,eslintrc,prettierrc}": [ "prettier --write" ] -} +} \ No newline at end of file diff --git a/.storybook/main.js b/.storybook/main.js index 1e50d62..dbb2b05 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -3,7 +3,7 @@ const path = require("path") const toPath = (_path) => path.join(process.cwd(), _path) module.exports = { - stories: ["../packages/**/stories/*.stories.tsx"], + stories: ["../src/**/stories/*.stories.tsx"], addons: [ "storybook-addon-performance/register", "@storybook/addon-a11y", diff --git a/.vscode/settings.json b/.vscode/settings.json index 55712c1..e9057af 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,6 @@ { - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file + "typescript.tsdk": "node_modules/typescript/lib", + "css.styleSheets": [ + "https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" + ] +} diff --git a/README.md b/README.md index f48d5a5..0ef549c 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,32 @@ -# What's this? +# Learnblocks Composable react components for the creation and display of digital learing content. # Goals -Enable the creation of great digital learning content though: +- simplify and accelerate the development of learning applications and authoring + tools +- provide accessible, customizable and easy to use components +- provide a concept/framework for building further components +- provide great UX and DX -- high quality components -- composable (simple components) -- great UX -- accessibility +# Installation -... +**Currently the project is in alpha. API changes are extremly likely.** + +```sh +$ yarn add @learnblocks/core +# or +$ npm i @learnblocks/core +``` + +# Example + +- [Multiple Choice Presenter](https://codesandbox.io/s/learnblocks-choice-presenter-pgknv?file=/src/index.tsx) +- [Multiple Choice Presenter with Custom Atoms](https://codesandbox.io/s/learnblocks-choice-presenter-custom-atoms-vvizo?file=/src/index.tsx) +- Editor / Presenter Example (TODO) +- Example for custom Atoms which add functionality (e.g. richtext) # Concept @@ -20,35 +34,58 @@ Enable the creation of great digital learning content though: ### Block (Data) -The whole concept of this library revolves around _Blocks_. A _Block_ is -described by its type and an instance of a block is represented by a -datastructure of that type. - -### Atom +The whole concept of this library revolves around _Blocks_. A _Block_ is a +datastructure which describes an element. -An _Atom_ is a react component that is used to compose the editor and presenter -components (see below). The idea is, that you can simply swap the atoms without -touching the actual editor and presenter. This: +Example: -- makes learnblocks UI-Component agnostic (use components of your choice e.g. - Material UI, Chakra UI, ...). -- allows to customize behaviour (swap plain-text-inputs with custom-inputs. - Enable Richtext, Latex etc.) +```JSON +{ + "type": "choice", + "hideCorrectCount": false, + "options": [ + { "content": "yes", "isCorrect": true }, + { "content": "no", "isCorrect": true }, + { "content": "maybe", "isCorrect": false }, + ], +} +``` ### Editor An _Editor_ is a react component that takes a block of a certain type as an -input and renders a Userinterface which allows the modification of the block. It -must be composed of atoms. +input and renders a UI which allows a user to modify the block. ### Presenter An Presenter is a react component that takes a block of a certain type as an -input and renders a Userinterface which allows the interaction with the block. -The Presenter has two callbacks: `onChange` and `onResult`. Both callbacks take +input and renders a UI that allows to interact with the Block (e.g. answering a +multiple-choice question). + +``` + * (user is answering) (show solution, state may be altered) (interaction is completed) + * [interaction] --> [staged] --> [committed] + * <-- ⮠ +``` + +A Presenter has three callbacks: `onChange`, `onStage` and `onCommit`. Each take the presenter state as an argument. The presenter state contains all the information to reinitialize the presenter and to determine if an interaction is -completed (result). +completed (committed). + +# How to contribute + +- Fix Bugs +- Fix `TODO`s and `FIXME`s (see Code) +- Write tests +- Implement more Blocks + - Fill in the Blanks + - Feedback + - (static) Blocks like Text, Images, Video, Embeds + - Think about the components you need or draw inspiration from + [H5P](https://h5p.org/) +- Improve default Atoms +- Create new atoms (Maybe with Tailwind?) # Start Developing @@ -57,6 +94,10 @@ learnblocks. ## Add a new component +--- + +## FIXME: Template is not up-to-date. Do not use. + Run `yarn gen:pkg` and enter a name (lowercase) and a description for the component you'd like to implement. Run `yarn start` to start if it was not already started storybook. You should see your component in the storybook. Edit @@ -65,5 +106,5 @@ component. # Attribution -The structure and setup of this repository is mostly copied from the +Parts of this repositories structure are inspired by the [chakra-ui](https://github.com/chakra-ui/chakra-ui/) project. diff --git a/babel.config.js b/babel.config.js index 8b3f967..86f195a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -20,7 +20,9 @@ module.exports = function (api) { "@babel/preset-react", ] - const plugins = ["@babel/plugin-proposal-class-properties"] + const plugins = [ + //"@babel/plugin-proposal-class-properties" + ] return { presets, diff --git a/lerna.json b/lerna.json deleted file mode 100644 index 3414be1..0000000 --- a/lerna.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "packages": ["packages/*"], - "version": "independent", - "npmClient": "yarn", - "useWorkspaces": true, - "registry": "https://registry.npmjs.org/", - "command": { - "version": { "exact": true }, - "publish": { - "conventionalCommits": true, - "message": "chore(release): publish", - "ignoreChanges": ["**/stories/**", "**/tests/**"], - "allowBranch": "master" - } - } -} diff --git a/package.json b/package.json index cd33d72..a2495c5 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,34 @@ { - "name": "learnblocks", - "private": true, - "workspaces": { - "packages": [ - "packages/*" - ], - "nohoist": [] + "name": "@learnblocks/core", + "version": "1.0.0-alpha.16", + "description": "Composable react components for the creation and display of digital learing content.", + "publishConfig": { + "access": "public" }, - "repository": { - "type": "git", - "url": "git+https://github.com/siggi-learn/learnblocks.git" - }, - "author": "Malte Hecht ", - "license": "MIT", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "sideEffects": false, + "files": [ + "dist" + ], "scripts": { - "pkg": "manypkg run", - "check:pkgs": "manypkg check", - "fix:pkgs": "manypkg fix", - "version:pkgs": "changeset version", - "postinstall": "yarn check:pkgs", - "csb:pkgs": "node -r esm scripts/csb.js", - "csb:install": "yarn prestart && yarn csb:pkgs", - "contributors:add": "all-contributors add", - "contributors:gen": "all-contributors generate", - "prestart": "yarn && yarn bootstrap", - "boot": "yarn prestart && yarn build", - "start": "yarn storybook", - "start:all": "yarn build && concurrently \"yarn docs dev\" \"yarn storybook\" ", - "build": "lerna run build --ignore @learnblocks/test-utils --no-private --stream", - "build:templates": "ts-node -T scripts/build-templates.ts", - "test": "lerna run test --no-private --stream", - "lint": "lerna run lint --no-private --stream", - "lint:types": "lerna run lint:types --no-private --stream", - "prestorybook": "rimraf node_modules/.cache/storybook", - "storybook": "start-storybook -p 6006", - "clean": "lerna clean --yes && rm -rf node_modules", - "bootstrap": "lerna bootstrap --use-workspaces", + "prebuild": "rimraf dist", + "build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json", "commit": "git-cz", - "build:storybook": "build-storybook && sb extract", - "members:gen": "ts-node scripts/all-members.ts", - "avatars:gen": "ts-node scripts/avatars.ts", - "search-meta:gen": "ts-node scripts/get-search-meta.ts", "gen:pkg": "ts-node scripts/plopfile.ts", - "release": "changeset publish", - "docs": "yarn workspace @learnblocks/docs", - "docs:deploy": "yarn build && yarn docs:build-ci && cp -r website/public .", - "docs:build-ci": "yarn members:gen && yarn docs:build", - "docs:build": "yarn avatars:gen && yarn search-meta:gen && yarn docs build", - "docs:dev": "yarn avatars:gen && yarn docs dev", - "docs:start": "yarn docs start", - "dedup": "yarn-deduplicate --strategy highest yarn.lock" + "prepublish": "yarn build", + "start": "start-storybook -p 6006", + "watch:build": "watch 'yarn build && yalc push' ./src" }, - "resolutions": { - "**/react": "17.0.1", - "**/react-dom": "17.0.1" + "repository": { + "type": "git", + "url": "git+https://github.com/siggi-learn/learnblocks.git" }, - "version": "1.0.0", "dependencies": { + "js-levenshtein": "^1.1.6", + "lodash": "^4.17.21" + }, + "devDependencies": { "@babel/cli": "7.12.10", "@babel/core": "^7.12.10", "@babel/plugin-proposal-class-properties": "7.12.1", @@ -64,44 +36,24 @@ "@babel/preset-react": "7.12.10", "@babel/preset-typescript": "7.12.7", "@babel/runtime": "7.12.5", - "@changesets/changelog-github": "0.2.7", - "@changesets/cli": "2.12.0", - "@commitlint/cli": "11.0.0", - "@commitlint/config-conventional": "11.0.0", + "@commitlint/cli": "^12.1.1", + "@commitlint/config-conventional": "^12.1.1", "@jest/types": "26.6.2", - "@manypkg/cli": "0.17.0", - "@storybook/addon-a11y": "6.1.11", - "@storybook/addon-actions": "6.1.10", - "@storybook/addon-knobs": "6.1.11", + "@storybook/addon-a11y": "^6.1.11", + "@storybook/addon-actions": "^6.1.10", + "@storybook/addon-knobs": "^6.1.11", "@storybook/addon-toolbars": "^6.1.11", - "@storybook/cli": "6.1.11", - "@storybook/react": "6.1.11", - "@types/imagemin": "7.0.0", - "@types/imagemin-jpegtran": "5.0.0", + "@storybook/cli": "^6.1.11", + "@storybook/react": "^6.1.11", "@types/jest": "^26.0.19", - "@types/mkdirp": "1.0.1", - "@types/node": "^14.14.19", + "@types/js-levenshtein": "^1.1.0", + "@types/lodash": "^4.14.168", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", - "@types/react-router-dom": "5.1.7", - "@types/react-table": "7.0.26", - "@types/shelljs": "0.8.8", - "@types/uuid": "8.3.0", "@typescript-eslint/eslint-plugin": "4.11.1", "@typescript-eslint/parser": "4.11.1", - "all-contributors-cli": "6.19.0", - "arg": "5.0.0", "babel-eslint": "10.1.0", "babel-loader": "8.2.2", - "bundlesize": "0.18.0", - "chalk": "4.1.0", - "commitizen": "4.2.2", - "concurrently": "5.3.0", - "cross-env": "7.0.3", - "csstype": "^3.0.6", - "cz-conventional-changelog": "3.3.0", - "dotenv-cli": "4.0.0", - "edit-json-file": "1.5.0", "eslint": "7.17.0", "eslint-config-airbnb-typescript": "12.0.0", "eslint-config-prettier": "7.1.0", @@ -113,43 +65,38 @@ "eslint-plugin-react-hooks": "4.2.0", "eslint-plugin-testing-library": "3.9.2", "esm": "3.2.25", - "execa": "5.0.0", - "fs-utils": "0.7.0", + "git-cz": "^4.7.6", "husky": "4.3.6", - "imagemin": "7.0.1", - "imagemin-jpegtran": "7.0.0", - "inquirer": "7.3.3", "jest": "26.6.3", "jest-environment-jsdom": "26.6.2", "jest-watch-typeahead": "0.6.1", - "lerna": "3.22.1", - "lint-staged": "10.5.3", - "listr": "0.14.3", - "markdown-toc": "1.2.0", - "mkdirp": "^1.0.4", - "ncp": "2.0.0", - "node-fetch": "2.6.1", - "nodemon": "2.0.6", - "pkg-dir": "^4.2.0", + "lint-staged": "^10.5.4", "plop": "2.7.4", "prettier": "^2.2.1", - "react": "^17.0.1", - "react-dom": "^17.0.1", - "react-hook-form": "6.14.0", - "react-icons": "^4.1.0", - "react-lorem-component": "0.13.0", - "react-router-dom": "5.2.0", - "react-spinners": "0.10.4", - "react-table": "7.6.2", + "react": "^18.0.0", + "react-dom": "^18.0.0", "react-test-renderer": "^17.0.1", - "rimraf": "3.0.2", - "sharp": "0.27.0", - "shelljs": "0.8.4", - "storybook-addon-performance": "0.13.0", + "rimraf": "^3.0.2", + "storybook-addon-performance": "^0.13.0", "ts-jest": "26.4.4", - "ts-node": "9.1.1", + "ts-node": "^9.1.1", "typescript": "^4.1.3", - "uuid": "8.3.2", - "yarn-deduplicate": "3.1.0" - } + "watch": "^1.0.2" + }, + "peerDependencies": { + "react": "^17.0.0 || ^18.0.0", + "react-dom": "^17.0.0 || ^18.0.0" + }, + "author": "Malte Hecht ", + "license": "MIT", + "homepage": "https://github.com/siggi-learn/learnblocks#readme", + "bugs": { + "url": "https://github.com/siggi-learn/learnblocks/issues" + }, + "keywords": [ + "react", + "education", + "ui", + "learncontent" + ] } diff --git a/packages/atoms-bootstrap/README.md b/packages/atoms-bootstrap/README.md deleted file mode 100644 index cff4951..0000000 --- a/packages/atoms-bootstrap/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# @learnblocks/atoms-default - -A Quick description of the component - -## Installation - -```sh -yarn add @learnblocks/atoms-default -# or -npm i @learnblocks/atoms-default -``` - -## Contribution - -Yes please! See the -[contributing guidelines](https://github.com/siggi-learn/learnblocks/blob/master/CONTRIBUTING.md) -for details. - -## Licence - -This project is licensed under the terms of the -[MIT license](https://github.com/siggi-learn/learnblocks/blob/master/LICENSE). \ No newline at end of file diff --git a/packages/atoms-bootstrap/index.ts b/packages/atoms-bootstrap/index.ts deleted file mode 100644 index 1b98e37..0000000 --- a/packages/atoms-bootstrap/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src" \ No newline at end of file diff --git a/packages/atoms-bootstrap/jest.config.js b/packages/atoms-bootstrap/jest.config.js deleted file mode 100644 index f53da11..0000000 --- a/packages/atoms-bootstrap/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - collectCoverageFrom: ["tests/**/*.{ts,tsx,js,jsx}"], - transform: { - ".(ts|tsx)$": "ts-jest/dist", - }, - transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"], - setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], -} diff --git a/packages/atoms-bootstrap/package.json b/packages/atoms-bootstrap/package.json deleted file mode 100644 index 59c9742..0000000 --- a/packages/atoms-bootstrap/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@learnblocks/atoms-bootstrap", - "version": "1.0.0", - "description": "Bootstrap Atoms for the learnblocks", - "keywords": [ - "react", - "education", - "learning", - "bootstrap" - ], - "author": "Malte Hecht ", - "homepage": "https://github.com/siggi-learn/learnblocks#readme", - "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", - "typings": "dist/types/index.d.ts", - "sideEffects": false, - "exports": { - ".": { - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/siggi-learn/learnblocks.git" - }, - "bugs": { - "url": "https://github.com/siggi-learn/learnblocks/issues" - }, - "scripts": { - "prebuild": "rimraf dist", - "start": "nodemon --watch src --exec yarn build -e ts,tsx", - "build": "concurrently yarn:build:*", - "test": "jest --env=jsdom --passWithNoTests", - "lint": "concurrently yarn:lint:*", - "version": "yarn build", - "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps", - "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps", - "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types", - "test:cov": "yarn test --coverage", - "lint:src": "eslint src --ext .ts,.tsx --config ../../.eslintrc", - "lint:types": "tsc --noEmit" - }, - "dependencies": { - "@learnblocks/types": "*" - }, - "devDependencies": { - "react": "^17.0.1", - "react-bootstrap": "^1.5.2" - }, - "peerDependencies": { - "react": ">=16.8.6", - "react-bootstrap": "^1.5.2" - } -} diff --git a/packages/atoms-bootstrap/src/index.tsx b/packages/atoms-bootstrap/src/index.tsx deleted file mode 100644 index 7968868..0000000 --- a/packages/atoms-bootstrap/src/index.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { AtomsInterface } from "@learnblocks/types" -import * as React from "react" -import { Button, Form } from "react-bootstrap" - -export const SubmitAnswerButtonAtom = (props: any) => ( - -) -export const FormAtom = (props: any) =>
-export const TextinputAtom = (props: any) => ( - -) -export const TextAtom = (props: any) =>

-export const TextAreaAtom = (props: any) => ( - -) - -export const CorrectDisplayAtom: AtomsInterface["correctDisplay"] = ({ - isCorrect, -}) => <>{isCorrect ? "Richtig 🎉" : "Falsch 🙁"} - -export const ScoreDisplayAtom: AtomsInterface["scoreDisplay"] = ({ - score, - scoreMax, -}) => ( - <> - {score} / {scoreMax} Punkte - -) - -export const atoms: AtomsInterface = { - submitAnswerButton: SubmitAnswerButtonAtom, - scoreDisplay: ScoreDisplayAtom, - correctDisplay: CorrectDisplayAtom, - form: FormAtom, - text: TextAtom, - textinput: TextinputAtom, - textarea: TextAreaAtom, -} diff --git a/packages/atoms-bootstrap/tests/atoms-default-editor.test.tsx b/packages/atoms-bootstrap/tests/atoms-default-editor.test.tsx deleted file mode 100644 index cd060fc..0000000 --- a/packages/atoms-bootstrap/tests/atoms-default-editor.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 📝 Notes for Contributors: - * - * - Ensure you write tests for the accessibility and interactions. - * - No snapshot tests for components please! 🙂 - * - */ - -import * as React from "react"; -import { AtomsDefaultEditor } from "../src"; - -describe("AtomsDefaultEditor", () => { - test("it works", () => { - expect(true).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/packages/atoms-bootstrap/tests/atoms-default-presenter.test.tsx b/packages/atoms-bootstrap/tests/atoms-default-presenter.test.tsx deleted file mode 100644 index 41c4a4d..0000000 --- a/packages/atoms-bootstrap/tests/atoms-default-presenter.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 📝 Notes for Contributors: - * - * - Ensure you write tests for the accessibility and interactions. - * - No snapshot tests for components please! 🙂 - * - */ - -import * as React from "react"; -import { AtomsDefaultPresenter } from "../src"; - -describe("AtomsDefaultPresenter", () => { - test("it works", () => { - expect(true).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/packages/atoms-bootstrap/tsconfig.json b/packages/atoms-bootstrap/tsconfig.json deleted file mode 100644 index e111b67..0000000 --- a/packages/atoms-bootstrap/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src"], - "exclude": [ - "src/tests", - "**/*.spec.ts", - "**/*.spec.tsx", - "**/*.test.ts", - "**/*.test.tsx", - "**/*/*.stories.tsx" - ] -} diff --git a/packages/short-text-answer/README.md b/packages/short-text-answer/README.md deleted file mode 100644 index b1e5bcb..0000000 --- a/packages/short-text-answer/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# @learnblocks/short-text-answer - -A Quick description of the component - -## Installation - -```sh -yarn add @learnblocks/short-text-answer -# or -npm i @learnblocks/short-text-answer -``` - -## Contribution - -Yes please! See the -[contributing guidelines](https://github.com/siggi-learn/learnblocks/blob/master/CONTRIBUTING.md) -for details. - -## Licence - -This project is licensed under the terms of the -[MIT license](https://github.com/siggi-learn/learnblocks/blob/master/LICENSE). \ No newline at end of file diff --git a/packages/short-text-answer/index.ts b/packages/short-text-answer/index.ts deleted file mode 100644 index 1b98e37..0000000 --- a/packages/short-text-answer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src" \ No newline at end of file diff --git a/packages/short-text-answer/jest.config.js b/packages/short-text-answer/jest.config.js deleted file mode 100644 index f53da11..0000000 --- a/packages/short-text-answer/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - collectCoverageFrom: ["tests/**/*.{ts,tsx,js,jsx}"], - transform: { - ".(ts|tsx)$": "ts-jest/dist", - }, - transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"], - setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], -} diff --git a/packages/short-text-answer/package.json b/packages/short-text-answer/package.json deleted file mode 100644 index 24768c3..0000000 --- a/packages/short-text-answer/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@learnblocks/short-text-answer", - "version": "1.0.0", - "description": "", - "keywords": [ - "react", - "education", - "learning" - ], - "author": "Malte Hecht ", - "homepage": "https://github.com/siggi-learn/learnblocks#readme", - "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", - "typings": "dist/types/index.d.ts", - "sideEffects": false, - "exports": { - ".": { - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/siggi-learn/learnblocks.git" - }, - "bugs": { - "url": "https://github.com/siggi-learn/learnblocks/issues" - }, - "scripts": { - "prebuild": "rimraf dist", - "start": "nodemon --watch src --exec yarn build -e ts,tsx", - "build": "concurrently yarn:build:*", - "test": "jest --env=jsdom --passWithNoTests", - "lint": "concurrently yarn:lint:*", - "version": "yarn build", - "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps", - "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps", - "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types", - "test:cov": "yarn test --coverage", - "lint:src": "eslint src --ext .ts,.tsx --config ../../.eslintrc", - "lint:types": "tsc --noEmit" - }, - "dependencies": { - "@learnblocks/types": "*", - "@learnblocks/utils": "*" - }, - "devDependencies": { - "react": "^17.0.1" - }, - "peerDependencies": { - "react": ">=16.8.6" - } -} diff --git a/packages/short-text-answer/src/index.ts b/packages/short-text-answer/src/index.ts deleted file mode 100644 index 1801f03..0000000 --- a/packages/short-text-answer/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./short-text-answer-editor" -export * from "./short-text-answer-presenter" -export { ShortTextAnswerBlock } from "./types" diff --git a/packages/short-text-answer/src/short-text-answer-editor.tsx b/packages/short-text-answer/src/short-text-answer-editor.tsx deleted file mode 100644 index 9a9e503..0000000 --- a/packages/short-text-answer/src/short-text-answer-editor.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 📝 Notes for Contributors: - */ - -import { BlockEditor } from "@learnblocks/types" -import { withAtoms } from "@learnblocks/utils" -import * as React from "react" -import { ShortTextAnswerBlock } from "./types" - -const ShortTextAnswerEditorComponent: BlockEditor = ({ - atoms, - block, - onChange, -}) => { - const handleChange = (e: React.ChangeEvent) => - onChange && onChange({ ...block, correctAnswer: e.currentTarget.value }) - - return ( - - ) -} - -export const ShortTextAnswerEditor = withAtoms(ShortTextAnswerEditorComponent) diff --git a/packages/short-text-answer/src/short-text-answer-presenter.tsx b/packages/short-text-answer/src/short-text-answer-presenter.tsx deleted file mode 100644 index 1fec7f4..0000000 --- a/packages/short-text-answer/src/short-text-answer-presenter.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 📝 Notes for Contributors: - */ - -import { BlockPresenter } from "@learnblocks/types" -import { withAtoms } from "@learnblocks/utils" -import * as React from "react" -import { ShortTextAnswerAnswerState, ShortTextAnswerBlock } from "./types" - -export const ShortTextAnswerPresenterComponent: BlockPresenter< - ShortTextAnswerBlock, - ShortTextAnswerAnswerState -> = ({ atoms, block, onResult, defaultAnswerState, hideFeedback }) => { - const [ - answerState, - setAnswerState, - ] = React.useState( - defaultAnswerState || { givenAnswer: "" }, - ) - const handleChange = (e: React.ChangeEvent) => - setAnswerState({ ...answerState, givenAnswer: e.currentTarget.value }) - - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault() - const isCorrect = block.correctAnswer === answerState.givenAnswer - const newAnswerState = { ...answerState, isCorrect, isCompleted: true } - setAnswerState(newAnswerState) - if (onResult) onResult(newAnswerState) - } - - return ( - - - - {!hideFeedback && answerState.isCompleted && ( - - )} - - ) -} - -export const ShortTextAnswerPresenter = withAtoms( - ShortTextAnswerPresenterComponent, -) diff --git a/packages/short-text-answer/src/types.ts b/packages/short-text-answer/src/types.ts deleted file mode 100644 index fb37b20..0000000 --- a/packages/short-text-answer/src/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { AnswerState, Block } from "@learnblocks/types" - -export interface ShortTextAnswerBlock extends Block { - correctAnswer: string -} - -export interface ShortTextAnswerAnswerState extends AnswerState { - givenAnswer: string -} diff --git a/packages/short-text-answer/stories/short-text-answer.stories.tsx b/packages/short-text-answer/stories/short-text-answer.stories.tsx deleted file mode 100644 index 68671e7..0000000 --- a/packages/short-text-answer/stories/short-text-answer.stories.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { AnswerState } from "@learnblocks/types" -import { StoryGrid } from "@learnblocks/utils" -import * as React from "react" -import { - ShortTextAnswerBlock, - ShortTextAnswerEditor, - ShortTextAnswerPresenter, -} from "../src" - -export default { - title: "ShortTextAnswer", - decorators: [(story: Function) =>

{story()}
], -} - -export const Basic = () => { - const [block, setBlock] = React.useState({ - type: "text", - correctAnswer: "", - }) - const [result, setResult] = React.useState({}) - - return ( - } - presenter={ - - } - result={result} - /> - ) -} diff --git a/packages/short-text-answer/tsconfig.json b/packages/short-text-answer/tsconfig.json deleted file mode 100644 index e111b67..0000000 --- a/packages/short-text-answer/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src"], - "exclude": [ - "src/tests", - "**/*.spec.ts", - "**/*.spec.tsx", - "**/*.test.ts", - "**/*.test.tsx", - "**/*/*.stories.tsx" - ] -} diff --git a/packages/text/README.md b/packages/text/README.md deleted file mode 100644 index f12e414..0000000 --- a/packages/text/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# @learnblocks/text - -A Quick description of the component - -## Installation - -```sh -yarn add @learnblocks/text -# or -npm i @learnblocks/text -``` - -## Contribution - -Yes please! See the -[contributing guidelines](https://github.com/siggi-learn/learnblocks/blob/master/CONTRIBUTING.md) -for details. - -## Licence - -This project is licensed under the terms of the -[MIT license](https://github.com/siggi-learn/learnblocks/blob/master/LICENSE). \ No newline at end of file diff --git a/packages/text/index.ts b/packages/text/index.ts deleted file mode 100644 index 1b98e37..0000000 --- a/packages/text/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src" \ No newline at end of file diff --git a/packages/text/jest.config.js b/packages/text/jest.config.js deleted file mode 100644 index f53da11..0000000 --- a/packages/text/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - collectCoverageFrom: ["tests/**/*.{ts,tsx,js,jsx}"], - transform: { - ".(ts|tsx)$": "ts-jest/dist", - }, - transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"], - setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], -} diff --git a/packages/text/package.json b/packages/text/package.json deleted file mode 100644 index d23a2b7..0000000 --- a/packages/text/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@learnblocks/text", - "version": "1.0.0", - "description": "Editor and Presenter for texts", - "keywords": [ - "react", - "education", - "learning" - ], - "author": "Malte Hecht ", - "homepage": "https://github.com/siggi-learn/learnblocks#readme", - "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", - "typings": "dist/types/index.d.ts", - "sideEffects": false, - "exports": { - ".": { - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/siggi-learn/learnblocks.git" - }, - "bugs": { - "url": "https://github.com/siggi-learn/learnblocks/issues" - }, - "scripts": { - "prebuild": "rimraf dist", - "start": "nodemon --watch src --exec yarn build -e ts,tsx", - "build": "concurrently yarn:build:*", - "test": "jest --env=jsdom --passWithNoTests", - "lint": "concurrently yarn:lint:*", - "version": "yarn build", - "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps", - "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps", - "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types", - "test:cov": "yarn test --coverage", - "lint:src": "eslint src --ext .ts,.tsx --config ../../.eslintrc", - "lint:types": "tsc --noEmit" - }, - "dependencies": { - "@learnblocks/types": "*", - "@learnblocks/utils": "*" - }, - "devDependencies": { - "react": "^17.0.1" - }, - "peerDependencies": { - "react": ">=16.8.6" - } -} diff --git a/packages/text/src/index.ts b/packages/text/src/index.ts deleted file mode 100644 index 0900e58..0000000 --- a/packages/text/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./text-editor" -export * from "./text-presenter" -export { TextBlock } from "./types" diff --git a/packages/text/src/text-editor.tsx b/packages/text/src/text-editor.tsx deleted file mode 100644 index 45ca63e..0000000 --- a/packages/text/src/text-editor.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { BlockEditor } from "@learnblocks/types" -import { withAtoms } from "@learnblocks/utils" -import * as React from "react" -import { TextBlock } from "./types" - -const TextEditorComponent: BlockEditor = ({ - atoms, - block, - onChange, -}) => { - const handleChange = (e: React.ChangeEvent) => - onChange && onChange({ ...block, text: e.currentTarget.value }) - - return -} - -export const TextEditor = withAtoms(TextEditorComponent) diff --git a/packages/text/src/text-presenter.tsx b/packages/text/src/text-presenter.tsx deleted file mode 100644 index 7b2eb3b..0000000 --- a/packages/text/src/text-presenter.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { BlockPresenter } from "@learnblocks/types" -import { withAtoms } from "@learnblocks/utils" -import * as React from "react" -import { TextBlock } from "./types" - -const TextPresenterComponent: BlockPresenter = ({ - atoms, - block, - onResult, -}) => { - React.useEffect(() => onResult && onResult({}), [onResult, block.text]) - - return -} - -export const TextPresenter = withAtoms(TextPresenterComponent) diff --git a/packages/text/src/types.ts b/packages/text/src/types.ts deleted file mode 100644 index 7969e5d..0000000 --- a/packages/text/src/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Block } from "@learnblocks/types" - -export interface TextBlock extends Block { - text: string -} diff --git a/packages/text/stories/text.stories.tsx b/packages/text/stories/text.stories.tsx deleted file mode 100644 index edc5558..0000000 --- a/packages/text/stories/text.stories.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { AnswerState } from "@learnblocks/types" -import { StoryGrid } from "@learnblocks/utils" -import * as React from "react" -import { TextBlock, TextEditor, TextPresenter } from "../src" - -export default { - title: "Text", - decorators: [(story: Function) =>
{story()}
], -} - -export const Basic = () => { - const [block, setBlock] = React.useState({ - type: "text", - text: "hi there", - }) - const [result, setResult] = React.useState({}) - - return ( - } - presenter={} - result={result} - /> - ) -} diff --git a/packages/text/tests/text-editor.test.tsx b/packages/text/tests/text-editor.test.tsx deleted file mode 100644 index 1e94f55..0000000 --- a/packages/text/tests/text-editor.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 📝 Notes for Contributors: - * - * - Ensure you write tests for the accessibility and interactions. - * - No snapshot tests for components please! 🙂 - * - */ - -import * as React from "react"; -import { TextEditor } from "../src"; - -describe("TextEditor", () => { - test("it works", () => { - expect(true).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/packages/text/tests/text-presenter.test.tsx b/packages/text/tests/text-presenter.test.tsx deleted file mode 100644 index e53c232..0000000 --- a/packages/text/tests/text-presenter.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 📝 Notes for Contributors: - * - * - Ensure you write tests for the accessibility and interactions. - * - No snapshot tests for components please! 🙂 - * - */ - -import * as React from "react"; -import { TextPresenter } from "../src"; - -describe("TextPresenter", () => { - test("it works", () => { - expect(true).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/packages/text/tsconfig.json b/packages/text/tsconfig.json deleted file mode 100644 index e111b67..0000000 --- a/packages/text/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src"], - "exclude": [ - "src/tests", - "**/*.spec.ts", - "**/*.spec.tsx", - "**/*.test.ts", - "**/*.test.tsx", - "**/*/*.stories.tsx" - ] -} diff --git a/packages/types/README.md b/packages/types/README.md deleted file mode 100644 index 4e994e2..0000000 --- a/packages/types/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# @learnblocks/types - -A Quick description of the component - -## Installation - -```sh -yarn add -D @learnblocks/types -# or -npm i @learnblocks/types --save-dev -``` - -## Contribution - -Yes please! See the -[contributing guidelines](https://github.com/siggi-learn/learnblocks/blob/master/CONTRIBUTING.md) -for details. - -## Licence - -This project is licensed under the terms of the -[MIT license](https://github.com/siggi-learn/learnblocks/blob/master/LICENSE). diff --git a/packages/types/index.ts b/packages/types/index.ts deleted file mode 100644 index 46e72b1..0000000 --- a/packages/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src" diff --git a/packages/types/package.json b/packages/types/package.json deleted file mode 100644 index 185ec2e..0000000 --- a/packages/types/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@learnblocks/types", - "version": "1.0.0", - "description": "Learnblocks types for blocks, editors and presenters", - "keywords": [ - "react", - "react-component", - "learnblocks", - "types" - ], - "author": "Malte Hecht ", - "homepage": "https://github.com/siggi-learn/learnblocks#readme", - "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", - "typings": "dist/types/index.d.ts", - "sideEffects": false, - "exports": { - ".": { - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/siggi-learn/learnblocks.git" - }, - "bugs": { - "url": "https://github.com/siggi-learn/learnblocks/issues" - }, - "scripts": { - "prebuild": "rimraf dist", - "start": "nodemon --watch src --exec yarn build -e ts,tsx", - "build": "concurrently yarn:build:*", - "test": "jest --env=jsdom --passWithNoTests", - "lint": "concurrently yarn:lint:*", - "version": "yarn build", - "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps", - "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps", - "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types", - "test:cov": "yarn test --coverage", - "lint:src": "eslint src --ext .ts,.tsx --config ../../.eslintrc", - "lint:types": "tsc --noEmit" - }, - "devDependencies": { - "@types/react": "^17.0.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.6" - } -} diff --git a/packages/types/src/atoms.ts b/packages/types/src/atoms.ts deleted file mode 100644 index 993eddb..0000000 --- a/packages/types/src/atoms.ts +++ /dev/null @@ -1,13 +0,0 @@ -export interface AtomsInterface { - // TBD - submitAnswerButton: (props: any) => React.ReactElement - scoreDisplay: (props: { - score?: number - scoreMax?: number - }) => React.ReactElement - correctDisplay: (props: { isCorrect?: boolean }) => React.ReactElement - form: (props: any) => React.ReactElement - text: (props: any) => React.ReactElement - textinput: (props: any) => React.ReactElement - textarea: (props: any) => React.ReactElement -} diff --git a/packages/types/src/data.ts b/packages/types/src/data.ts deleted file mode 100644 index 964332c..0000000 --- a/packages/types/src/data.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Shared interface for Blocks, Editors and Presenters - */ - -export interface AnswerState { - isCompleted?: boolean - isCorrect?: boolean - score?: number -} - -export interface Block { - type: string - scoreMax?: number -} diff --git a/packages/types/src/editor.ts b/packages/types/src/editor.ts deleted file mode 100644 index f991c3f..0000000 --- a/packages/types/src/editor.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { AtomsInterface } from "./atoms" -import { Block } from "./data" - -export type BlockEditorProps = { - atoms: AtomsInterface - block: T - onChange?: (block: T) => void -} - -export type BlockEditor = ( - props: BlockEditorProps, -) => React.ReactElement diff --git a/packages/types/src/presenter.ts b/packages/types/src/presenter.ts deleted file mode 100644 index 343c7f1..0000000 --- a/packages/types/src/presenter.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { AtomsInterface } from "./atoms" -import { AnswerState, Block } from "./data" - -export interface BlockPresenterProps< - T extends Block, - A extends AnswerState = AnswerState -> { - atoms: AtomsInterface - block: T - defaultAnswerState?: A - hideFeedback?: boolean - onResult?: (result: A) => void -} - -export type BlockPresenter< - T extends Block, - A extends AnswerState = AnswerState -> = (props: BlockPresenterProps) => React.ReactElement diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json deleted file mode 100644 index bb542f3..0000000 --- a/packages/types/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["."] -} diff --git a/packages/utils/README.md b/packages/utils/README.md deleted file mode 100644 index 42995d2..0000000 --- a/packages/utils/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# @learnblocks/utils - -A Quick description of the component - -## Installation - -```sh -yarn add @learnblocks/utils -# or -npm i @learnblocks/utils -``` - -## Contribution - -Yes please! See the -[contributing guidelines](https://github.com/siggi-learn/learnblocks/blob/master/CONTRIBUTING.md) -for details. - -## Licence - -This project is licensed under the terms of the -[MIT license](https://github.com/siggi-learn/learnblocks/blob/master/LICENSE). \ No newline at end of file diff --git a/packages/utils/index.ts b/packages/utils/index.ts deleted file mode 100644 index 46e72b1..0000000 --- a/packages/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src" diff --git a/packages/utils/jest.config.js b/packages/utils/jest.config.js deleted file mode 100644 index f53da11..0000000 --- a/packages/utils/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - collectCoverageFrom: ["tests/**/*.{ts,tsx,js,jsx}"], - transform: { - ".(ts|tsx)$": "ts-jest/dist", - }, - transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"], - setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], -} diff --git a/packages/utils/package.json b/packages/utils/package.json deleted file mode 100644 index 593caa2..0000000 --- a/packages/utils/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@learnblocks/utils", - "version": "1.0.0", - "description": "Types and utilities used by all learnblocks", - "keywords": [ - "react", - "react-components", - "learnblocks", - "utils" - ], - "author": "Malte Hecht ", - "homepage": "https://github.com/siggi-learn/learnblocks#readme", - "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", - "typings": "dist/types/index.d.ts", - "sideEffects": false, - "exports": { - ".": { - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/siggi-learn/learnblocks.git" - }, - "bugs": { - "url": "https://github.com/siggi-learn/learnblocks/issues" - }, - "scripts": { - "prebuild": "rimraf dist", - "start": "nodemon --watch src --exec yarn build -e ts,tsx", - "build": "concurrently yarn:build:*", - "test": "jest --env=jsdom --passWithNoTests", - "lint": "concurrently yarn:lint:*", - "version": "yarn build", - "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps", - "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps", - "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types", - "test:cov": "yarn test --coverage", - "lint:src": "eslint src --ext .ts,.tsx --config ../../.eslintrc", - "lint:types": "tsc --noEmit" - }, - "dependencies": { - "@learnblocks/atoms-bootstrap": "*" - }, - "peerDependencies": {} -} diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts deleted file mode 100644 index aa9480f..0000000 --- a/packages/utils/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./story-grid" -export * from "./with-atoms-hoc" diff --git a/packages/utils/src/story-grid.tsx b/packages/utils/src/story-grid.tsx deleted file mode 100644 index 65a9ead..0000000 --- a/packages/utils/src/story-grid.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { AnswerState } from "@learnblocks/types" -import * as React from "react" - -interface StoryGridProps { - editor: React.ReactElement - presenter: React.ReactElement - result: AnswerState -} - -export const StoryGrid: React.FC = ({ - editor, - presenter, - result, -}) => ( -
-
{editor}
-
{presenter}
-
- {JSON.stringify(result)} -
-
-) diff --git a/packages/utils/src/with-atoms-hoc.tsx b/packages/utils/src/with-atoms-hoc.tsx deleted file mode 100644 index ec67c14..0000000 --- a/packages/utils/src/with-atoms-hoc.tsx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * FIXME: Dynamic Atom import - * - receive and cast atoms from global var - * - remove all @learnblocks/atoms-... dependencies from package.json - **/ -import { atoms } from "@learnblocks/atoms-bootstrap" -import { AtomsInterface } from "@learnblocks/types" -import * as React from "react" - -export function withAtoms

( - Component: React.ComponentType

, -) { - return (props: P) => -} diff --git a/packages/utils/tests/utils-editor.test.tsx b/packages/utils/tests/utils-editor.test.tsx deleted file mode 100644 index 2c3a057..0000000 --- a/packages/utils/tests/utils-editor.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 📝 Notes for Contributors: - * - * - Ensure you write tests for the accessibility and interactions. - * - No snapshot tests for components please! 🙂 - * - */ - -import * as React from "react"; -import { UtilsEditor } from "../src"; - -describe("UtilsEditor", () => { - test("it works", () => { - expect(true).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/packages/utils/tests/utils-presenter.test.tsx b/packages/utils/tests/utils-presenter.test.tsx deleted file mode 100644 index a485117..0000000 --- a/packages/utils/tests/utils-presenter.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * 📝 Notes for Contributors: - * - * - Ensure you write tests for the accessibility and interactions. - * - No snapshot tests for components please! 🙂 - * - */ - -import * as React from "react"; -import { UtilsPresenter } from "../src"; - -describe("UtilsPresenter", () => { - test("it works", () => { - expect(true).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json deleted file mode 100644 index e111b67..0000000 --- a/packages/utils/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src"], - "exclude": [ - "src/tests", - "**/*.spec.ts", - "**/*.spec.tsx", - "**/*.test.ts", - "**/*.test.tsx", - "**/*/*.stories.tsx" - ] -} diff --git a/plop-templates/component-pkg/src/types.ts.hbs b/plop-templates/component-pkg/src/types.ts.hbs index 10f97ee..fc14cf7 100644 --- a/plop-templates/component-pkg/src/types.ts.hbs +++ b/plop-templates/component-pkg/src/types.ts.hbs @@ -1,4 +1,4 @@ -import { Block } from "@learnblocks/utils" +import { Block } from "@learnblocks/types" export interface {{properCase componentName}}Block extends Block { text: string diff --git a/plop-templates/component-pkg/src/{{componentName}}-editor.tsx.hbs b/plop-templates/component-pkg/src/{{componentName}}-editor.tsx.hbs index ace2ad4..2aafe96 100644 --- a/plop-templates/component-pkg/src/{{componentName}}-editor.tsx.hbs +++ b/plop-templates/component-pkg/src/{{componentName}}-editor.tsx.hbs @@ -2,16 +2,16 @@ * 📝 Notes for Contributors: */ -import { BlockEditor } from "@learnblocks/utils" +import { BlockEditor } from "@learnblocks/types" import { withAtoms } from "@learnblocks/utils" import * as React from "react" import { {{properCase componentName}}Block } from "./types" -export const {{properCase componentName}}EditorComponent: BlockEditor<{{properCase componentName}}Block> = ({ block, onChange }) => { +export const {{properCase componentName}}EditorComponent: BlockEditor<{{properCase componentName}}Block> = ({ atoms, block, onChange }) => { const handleChange = (e: React.ChangeEvent) => onChange && onChange({ ...block, text: e.currentTarget.value }) - return