Coder Social home page Coder Social logo

elastic / gatsby-eui-starter Goto Github PK

View Code? Open in Web Editor NEW
25.0 285.0 15.0 9.26 MB

Start building Kibana protoypes quickly with the Gatsby EUI Starter

Home Page: https://elastic.github.io/gatsby-eui-starter

License: Apache License 2.0

JavaScript 8.42% TypeScript 86.67% SCSS 4.91%

gatsby-eui-starter's Introduction

Gatsby

Elastic's Gatsby EUI Starter

Jump right in to building Kibana prototypes with EUI.

πŸš€ Quick start

  1. Install Gatsby.

    Assuming you already have NPM installed, install the gatsby-cli globally.

    npm install -g gatsby-cli
  2. Create a Gatsby site.

    Use the Gatsby CLI to create a new site, specifying the EUI starter.

    # create a new Gatsby site using the default starter
    gatsby new my-eui-starter https://github.com/elastic/gatsby-eui-starter
  3. Start developing.

    Navigate into your new site’s directory and start it up.

    cd my-eui-starter/
    gatsby develop
  4. Open the source code and start editing!

    Your site is now running at http://localhost:8000!

    Note: You'll also see a second link: http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

    Open the my-eui-starter directory in your code editor of choice and edit src/pages/index.tsx. Save your changes and the browser will update in real time!

  5. Deploy your site

    When you're ready to deploy and share, follow these steps.

    1. Modify the pathPrefix option in gatsby-config.js to reflect the name of your repo
    2. Setup a gh-pages branch in your repo and ensure that its enabled in the repository settings.
    3. Deploy with yarn deploy
    4. Access your site at https://your-username.github.io/repo-name

πŸ‘‡ According to Gatsby

🧐 What's inside?

A quick look at the top-level files and directories you'll see in a Gatsby project.

.
β”œβ”€β”€ node_modules
β”œβ”€β”€ src
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .prettierrc
β”œβ”€β”€ gatsby-browser.js
β”œβ”€β”€ gatsby-config.js
β”œβ”€β”€ gatsby-node.js
β”œβ”€β”€ gatsby-ssr.js
β”œβ”€β”€ LICENSE
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── README.md
  1. /node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.

  2. /src: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src is a convention for β€œsource code”.

  3. .gitignore: This file tells git which files it should not track / not maintain a version history for.

  4. .prettierrc: This is a configuration file for Prettier. Prettier is a tool to help keep the formatting of your code consistent.

  5. gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.

  6. gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail).

  7. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

  8. gatsby-ssr.js: This file is where Gatsby expects to find any usage of the Gatsby server-side rendering APIs (if any). These allow customization of default Gatsby settings affecting server-side rendering.

  9. LICENSE: Gatsby is licensed under the MIT license.

  10. package-lock.json (See package.json below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You won’t change this file directly).

  11. package.json: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.

  12. README.md: A text file containing useful reference information about your project.

πŸŽ“ Learning Gatsby

Looking for more guidance? Full documentation for Gatsby lives on the website. Here are some places to start:

  • For most developers, we recommend starting with our in-depth tutorial for creating a site with Gatsby. It starts with zero assumptions about your level of ability and walks through every step of the process.

  • To dive straight into code samples, head to our documentation. In particular, check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.

gatsby-eui-starter's People

Contributors

cchaos avatar chandlerprall avatar daveyholler avatar dependabot[bot] avatar snide avatar thompsongl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-eui-starter's Issues

Flesh out the header / user profile more

Although this now is up to date with EUI and it's nav system we should also start setting up the header to include the deployment switcher and fill in the user profile area.

Stacked Header disappears on 'gatsby build'

First of all - thank you for sharing!

I started working with this starter in gatsby develop and everything works as expected:

eui_gatsby-starter_dev

But when I run gatsby build the upper header is not rendered:

 gatsby -v
Gatsby CLI version: 2.19.1
Gatsby version: 2.32.3
  Note: this is the Gatsby version for the site at:
C:\Users\user\Desktop\gatsby-eui-starter-master

eui_gatsby-starter_build

Can someone confirm that this is an issue with the starter?

+++ EDIT

Adding a second Spacer component before {headers} "solves" the issue:

return (
    <ThemeContext.Provider value={theme}>
      <EuiSpacer />
      <EuiSpacer />
      {headers}
      {children}
    </ThemeContext.Provider>
  );

MVP suggestions

Tried this out tonight. Before you go too deep, I think you want the following in here at a minimum.

  1. Should probably use TypeScript since that's the direction everything is going and the last thing we want to do is convert it later.
  2. We should prolly get the breadcrumbs working with the routing somehow.
  3. Need a very minimum way to quickly deploy to GH pages.

Since this will be a public repo I think you want to be specific with naming. There's nothing Kibana in here, it's just loading EUI and I wouldn't want people confused of its intention. Likely gatsby-eui-starter makes more sense.

I can help out. I think this is really cool and we'd use it all the time.

Bug on node 14?

Thanks for this great starter!

I think I encountered a bug:
When starting a gatsby site with this I run into errors after starting the development server:

gatsby Cannot find module '@babel/compat-data/corejs3-shipped-proposals' which stops SSR rendering.

This was with node 14.3.0 on Mac OS, on my chromebook with a node 12 on ubuntu it worked.

The latest node 12 on Mac OS also had problems downgrading to node 12.16.3: yielded a working build.

I also could get it working on the mac (node 14) by upgrading all packages (not sure if that's a good idea)

This issues for node JS seems to outline it better: nodejs/node#32852 (comment)

WebpackError: TypeError: Right-hand side of 'instanceof' is not callable

I am getting the Error when adding EuiBasicTable to a page component:

WebpackError: TypeError: Right-hand side of 'instanceof' is not callable

warn The path "/path/to/page/" errored during SSR.
Edit its component node_modules/@elastic/eui/es/components/popover/popover.js:659:10 to resolve the     
error.

see popover.js:659:10:

if (ownFocus) {
        return /*#__PURE__*/React.createElement("div", _extends({
          className: classes,
          ref: popoverRef
        }, rest), /*#__PURE__*/React.createElement("div", {
          className: anchorClasses,
          ref: this.buttonRef
        }, button instanceof HTMLElement ? null : button), panel);
      } else {
        return /*#__PURE__*/React.createElement(EuiOutsideClickDetector, {
          onOutsideClick: this.closePopover
        }, /*#__PURE__*/React.createElement("div", _extends({
          className: classes,
          ref: popoverRef,
          onKeyDown: this.onKeyDown
        }, rest), /*#__PURE__*/React.createElement("div", {
          className: anchorClasses,
          ref: this.buttonRef
        }, button instanceof HTMLElement ? null : button), panel));
      }

I am using the example paginated table with the latest Gatsby version 3 / Webpack version 5.

Did anyone else run into that issue?

Gatsby build crashes on EUICodeBlock module

When trying to build a gatsby site created by this starter: the build fails with:

 ERROR #95312 

"document" is not available during server side rendering.

See our docs page for more info on this error: https://gatsby.dev/debug-html


  76 |     _this = _possibleConstructorReturn(this, _getPrototypeOf(EuiCodeBlockImpl).call(this, props));
  77 | 
> 78 |     _defineProperty(_assertThisInitialized(_this), "codeTarget", document.createElement('div'));
     | ^
  79 | 
  80 |     _defineProperty(_assertThisInitialized(_this), "code", null);
  81 | 


  WebpackError: ReferenceError: document is not defined
  
  - _code_block.js:78 new EuiCodeBlockImpl
    node_modules/@elastic/eui/es/components/code/_code_block.js:78:1

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.