Giter VIP home page Giter VIP logo

frontasic-components's Introduction

Frontastic Next.js Starter

ℹ️ Full documentation can be found Here

This is a Frontastic starter project that uses Next.js

Getting Started With Frontend:

1- Start the development environment

Running locally in development mode

yarn install
yarn dev

Building and deploying in production

yarn install
yarn build
yarn start

2- Create a basic component

export default function MyComponent(props) {
  return <h1>{props.headline}</h1>;
}

3- Create a tastic for your component

Under /packages/frontend/frontastic/tastics/{{MyComponent}}

  • Create a schema.json
{
  "tasticType": "my-component",
  "name": "My Component",
  "icon": "favorite",
  "category": "Content",
  "schema": [
    {
      "name": "Basic Options",
      "fields": [
        {
          "label": "Headline",
          "field": "headline",
          "type": "string",
          "required": true
        }
      ]
    }
  ]
}
  • Create an index.tsx
export default function MyComponentTastic(props) {
  return <MyComponent headline={props.data.headline} />;
}

You can find more about tastics Here

4- Register your tastic

Under /packages/frontend/frontastic/tastics/index.tsx

export const tastics = {
    ...
    'my-component': MyComponentTastic
}

5- Finally upload your component to studio

Fig.1 Fig.2

That's it.. Now you're all set and can start using your new component in any page you like!




Linting

This project uses linting rules that improve the Core Web Vitals of frontastic storefront which are also the recommended rules by Next.js.

In addition, the following rules are included as well to get reasonable defaults:

eslint:recommended plugin:react/recommended see eslint-plugin-react plugin:react-hooks/recommended see eslint-plugin-react-hooks

If you want more fine-grained configuration, all of the above can be configured, deactivated and/or extended in the .eslintrc.json in the project root folder.

To run the linter, just run

yarn lint

To fix erros that can be automatically fixed, run

yarn lint --fix

We recommend to add linting directly to your code editor or development environment, to get immediate feedback.

Linting in vim

There are a variety of extensions that can add linting support to vim and Neovim. If you're using vim, we recommend either ALE or CoC and if you use Neovim you can use the integrated Language Server Protocol to run eslint_d in the background. Here's a handy guide on how to do that

Linting in Visual Studio Code

To integrate ESLint into Visual Studio Code, you will need to install the ESLint extension for Visual Studio Code. Search for ESLint in the Extensions tab and click Install once you have located the extension. Once ESLint is installed in Visual Studio Code, you’ll notice colorful underlining in your JS/TS files highlighting errors. These markers are color-coded based on severity. If you hover over your underlined code, you will see a message that explains the error to you.

Prettier / Code formatting

We also recommend to setup your editor to use prettier to format a document on save.

To prettify your code, just run

yarn prettify

Prettier in vim

Prettier in Visual Studio Code

Full code formatting

To run linter with --fix flag and also prettify your code, you can run

yarn fix

This is typically equivalent to running yarn lint --fix and yarn prettify

frontasic-components's People

Contributors

xcintas avatar abdotaker608 avatar kenwaythegreat avatar sarasamain avatar minabadrous avatar rioderelfte avatar marcelfahle avatar kore avatar anshuman71 avatar skoschnicke avatar brunofjesus avatar hkovesdi avatar jimania avatar melaniehoek avatar cmourullo avatar khunor avatar trackerchum avatar mariusmhm avatar

Watchers

 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.