Giter Site home page Giter Site logo

sncegroup / contentful-ui-extensions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from last-rev-llc/contentful-ui-extensions

0.0 1.0 0.0 5.8 MB

Useful UI Extensions we use at Last Rev for customer projects

HTML 0.41% JavaScript 97.33% Shell 0.07% SCSS 2.19%

contentful-ui-extensions's Introduction

Last Rev UI Extension Library

A collection of UI Extensions for Contentful like a Color picker, SEO, Categories and more.

Getting Started

Clone the repository

git clone [email protected]:last-rev-llc/contentful-ui-extensions.git

Install Dependencies

npm install

OR

yarn install

Start the application

npm start

Running Locally

In order to help streamline the process of development we have created a mock SDK that allows you to run the extensions locally with hot reload. You can also use this to see mock examples of the expected response from Contentful and data structure or objects.

Open the browser

http://localhost:3000/

This will be a list of all available UI Extensions.

Using Netlify Lambda Functions

Some UI Extensions, especially ones that integrate with third party services will need to communicate using a serverless function. We use Netlify for hosting and below are the instructions to run them locally

First you need to install the Netlify CLI Tools

npm install netlify-cli -g

To start the application use the following command instead of npm start. This starts a node server as well as your React application

ntl dev

Creating a new function

netlify functions:create function-name

Functions are located in the /lambda folder located in the project root directory. This is defined in the netlify.toml file

Notes on Functions:

  • You mush specify the headers in the return. For instance you must specify Access-Control-Allow-Origin to prevent CORS issues
  • You must include any dependencies you use in your Lambda functions in the main package.json
  • Environment Variables must be set in the Netlify UI and are availalbe locally when running ntl dev

Using in Contentful

To see the extension in your Contentful instance follow the directions below for each extension.

When running locally you will need to allow "unsafe" scripts to be allowed. This is because you run localhost with http and since Contentful injects it using an iFrame browsers will block them by default.

Individual Extension Documentation

Prerequisites

You need an account for Contentful to use these extensions.

Application Structure

.
├── public
├── src
│   ├── __mocks__
│   ├── extensions
│   ├── ├── BynderImages
│   ├── ├── ColorPicker
│   ├── ├── PersonName
│   ├── ├── PhoneNumber
│   ├── ├── Seo
│   ├── ├── FormStack
│   ├── shared
├── history.js
├── index.js
├── .env.local
├── .eslintrc.js
├── .gitignore
├── .nvmrc
└── README.md

Testing

We use Jest and React Testing Library for all integration testing.

Running Tests

Normal watch mode

npm test

Mocks

.
├── __mocks__
│   ├── mockContentfulAsset.js          # Mock Asset response from Contentful
│   ├── mockContentfulContentType.js    # Mock Content Type Response from Contentful
│   └── mockContentfulSdk.js            # Mock SDK used for mocking functions and data returned by Contentful
│   └── mockLocations.js                # Mock locations for Contentful
└── extensions
│   ├── Seo                             # Each extension has a _mocks_ folder and a mockFieldValue and mockAppConfig (for apps alpha)
│   ├── ├── __mocks__                   # mockFieldValue and mockAppConfig for SEO

Deployment

You can deploy this to Netlify with one click

Deploy to Netlify

Built With

Contributing

If you would like to contribute please submit a pull request. Make sure you write tests and it passes the linter before submitting.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

contentful-ui-extensions's People

Contributors

prceasar avatar bradtaylorsf avatar ajwhitley avatar rochaeb avatar tavurth avatar camiloriosf avatar altruity avatar dependabot[bot] avatar spindle79 avatar timbrooke avatar ct3685 avatar opassion avatar

Watchers

James Cloos 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.