GithubHelp home page GithubHelp logo

tranduyhung / react-prismic Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 147 KB

A simple app built with React and Prismic

HTML 2.98% JavaScript 65.95% CSS 31.07%
react reactjs prismic prismicio prismic-reactjs

react-prismic's Introduction

A Simple React - Prismic App

This is a simple app built with React JavaScript library, Prismic headless API content management system and Hagura Jekyll theme.

This app is built for personal experiment. If you would like to run it, follow the steps below. Feedback is always welcome!

Customization

Copy the following files to where they should be and edit them with your own configuration.

  • default/public/index.html to public/index.html
  • default/src/Components/Footer/Footer.js to src/Components/Footer/Footer.js
  • default/src/Config.js to src/Config.js
  • default/src/prismic-configuration.js to src/prismic-configuration.js

Create Prismic custom types

Home Page

This custom type is used for home page. Enter this custom type's API ID in src/Config.js (home_page_api_id). Here is its JSON:

{
  "Main" : {
    "uid" : {
      "type" : "UID",
      "config" : {
        "label" : "slug"
      }
    },
    "title" : {
      "type" : "StructuredText",
      "config" : {
        "single" : "heading1, heading2, heading3, heading4, heading5, heading6",
        "label" : "Title"
      }
    },
    "image" : {
      "type" : "Image",
      "config" : {
        "constraint" : {
          "width" : 800,
          "height" : 300
        },
        "thumbnails" : [ ],
        "label" : "Image"
      }
    },
    "content" : {
      "type" : "StructuredText",
      "config" : {
        "multi" : "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
        "label" : "Content"
      }
    }
  }
}

Blog Post

Create a custom type for blog post with the JSON below. Enter its API ID in src/Config.js (blog_post_api_id).

{
  "Main" : {
    "uid" : {
      "type" : "UID",
      "config" : {
        "label" : "slug"
      }
    },
    "title" : {
      "type" : "StructuredText",
      "config" : {
        "single" : "heading1, heading2, heading3, heading4, heading5, heading6",
        "label" : "Title"
      }
    },
    "image" : {
      "type" : "Image",
      "config" : {
        "constraint" : {
          "width" : 800,
          "height" : 300
        },
        "thumbnails" : [ ],
        "label" : "Image"
      }
    },
    "description" : {
      "type" : "StructuredText",
      "config" : {
        "single" : "strong, em",
        "label" : "Description"
      }
    },
    "content" : {
      "type" : "StructuredText",
      "config" : {
        "multi" : "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
        "label" : "Content"
      }
    },
    "created_date" : {
      "type" : "Timestamp",
      "config" : {
        "label" : "Created Date"
      }
    }
  }
}

Install dependencies

> $ npm install

Runs the app in the development mode

Build and open your browser to http://localhost:3000.

> $ npm start

Builds the app for production to the build folder

> $ npm run build

react-prismic's People

Contributors

tranduyhung avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.