From 852f0b13eb1be9fa0f9d58c75c403ccf1ac8c020 Mon Sep 17 00:00:00 2001 From: Shaung Date: Sun, 15 Sep 2019 18:35:14 -0700 Subject: [PATCH] commit files for #21; setup custom domain --- package.json | 6 +-- src/CNAME | 1 + .../form-rich-text-field-meta.tsx | 21 +++++++++ .../form-rich-text-field.tsx | 46 +++++++++++++++++++ src/custom-types.d.ts | 3 ++ 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/CNAME create mode 100644 src/components/form-factory/form-rich-text-field/form-rich-text-field-meta.tsx create mode 100644 src/components/form-factory/form-rich-text-field/form-rich-text-field.tsx create mode 100644 src/custom-types.d.ts diff --git a/package.json b/package.json index 3e1afcf..0585805 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "appl-tracky-spa", "version": "0.1.0", "private": true, - "homepage": "https://rivernews.github.io/appl-tracky-spa", + "homepage": "https://appl-tracky.shaungc.com", "dependencies": { "@ckeditor/ckeditor5-build-balloon": "^12.4.0", "@ckeditor/ckeditor5-react": "^1.1.3", @@ -37,8 +37,8 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "predeploy": "npm run build && cp build/index.html build/404.html ", - "deploy": "gh-pages -d build" + "predeploy": "npm run build && cp build/index.html build/404.html && cp src/CNAME build/CNAME ", + "deploy": "gh-pages -d build && echo 'https://rivernews.github.io/appl-tracky-spa'" }, "eslintConfig": { "extends": "react-app" diff --git a/src/CNAME b/src/CNAME new file mode 100644 index 0000000..2164b9b --- /dev/null +++ b/src/CNAME @@ -0,0 +1 @@ +appl-tracky.shaungc.com \ No newline at end of file diff --git a/src/components/form-factory/form-rich-text-field/form-rich-text-field-meta.tsx b/src/components/form-factory/form-rich-text-field/form-rich-text-field-meta.tsx new file mode 100644 index 0000000..7138352 --- /dev/null +++ b/src/components/form-factory/form-rich-text-field/form-rich-text-field-meta.tsx @@ -0,0 +1,21 @@ +// base field +import { FormBaseFieldMeta, IFormBaseFieldProps, IFieldBaseMetaProps } from "../form-base-field/form-base-field-meta"; +// input field +import { FormRichTextField } from "./form-rich-text-field"; + + +// API for caller to new props for input field +export interface IFormRichTextFieldProps extends IFormBaseFieldProps { +} + +// for defining meta +export interface IFormRichTextFieldMetaProps extends IFieldBaseMetaProps { +} + +export class FormRichTextFieldMeta extends FormBaseFieldMeta { + + constructor(props: IFormRichTextFieldMetaProps) { + super(props) + this.formField = FormRichTextField; + } +} \ No newline at end of file diff --git a/src/components/form-factory/form-rich-text-field/form-rich-text-field.tsx b/src/components/form-factory/form-rich-text-field/form-rich-text-field.tsx new file mode 100644 index 0000000..4400b6d --- /dev/null +++ b/src/components/form-factory/form-rich-text-field/form-rich-text-field.tsx @@ -0,0 +1,46 @@ +import React, { Component } from "react"; + +/** Components */ +// mdc react icon +import MaterialIcon from "@material/react-material-icon"; +// mdc react button +import "@material/react-button/dist/button.css"; +// mdc-react input +import "@material/react-text-field/dist/text-field.css"; +import TextField, { Input } from "@material/react-text-field"; +// formik +import { + Field, FieldProps, + ErrorMessage, +} from "formik"; +// input field +import { IFormRichTextFieldProps } from "./form-rich-text-field-meta"; +// ckeditor +import CKEditor from '@ckeditor/ckeditor5-react'; +import BalloonEditor from '@ckeditor/ckeditor5-build-balloon'; + +export class FormRichTextField extends Component { + render() { + return ( +
+ ) => { + return ( +
+
{this.props.label}
+ { + form.setFieldValue(field.name, editor.getData()); + } } + /> +
+ )}} + /> + +
+ ); + } +} \ No newline at end of file diff --git a/src/custom-types.d.ts b/src/custom-types.d.ts new file mode 100644 index 0000000..709dc2e --- /dev/null +++ b/src/custom-types.d.ts @@ -0,0 +1,3 @@ +declare module '@ckeditor/ckeditor5-react'; + +declare module '@ckeditor/ckeditor5-build-balloon'; \ No newline at end of file