Skip to content

Commit

Permalink
commit files for #21; setup custom domain
Browse files Browse the repository at this point in the history
  • Loading branch information
rivernews committed Sep 16, 2019
1 parent ead7734 commit 852f0b1
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
appl-tracky.shaungc.com
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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<IFormRichTextFieldProps> {
render() {
return (
<div className="FormRichTextField">
<Field
name={this.props.fieldName}
render={({ field, form }: FieldProps<number | string>) => {
return (
<div className="RichTextFieldInput">
<div><strong>{this.props.label}</strong></div>
<CKEditor
editor={BalloonEditor}
data={field.value}
onChange={ ( event: any, editor: any ) => {
form.setFieldValue(field.name, editor.getData());
} }
/>
</div>
)}}
/>
<ErrorMessage name={this.props.fieldName} />
</div>
);
}
}
3 changes: 3 additions & 0 deletions src/custom-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module '@ckeditor/ckeditor5-react';

declare module '@ckeditor/ckeditor5-build-balloon';

0 comments on commit 852f0b1

Please sign in to comment.