Git Product home page Git Product logo

carbon-tutorial-nextjs's Introduction

Carbon Tutorial for NextJS 13

This tutorial will guide you in creating a NextJS app with the Carbon Design System. We’ll teach you the ins and outs of using Carbon React components, while introducing web development best practices along the way.

Get started by visiting the tutorial instructions.

Create NextJS 13 app

yarn create next-app

✔ What is your project named? … next-base
✔ Would you like to use TypeScript?*No / Yes
✔ Would you like to use ESLint? … No / *Yes
✔ Would you like to use Tailwind CSS?*No / Yes
✔ Would you like to use `src/` directory? … No / *Yes
✔ Would you like to use App Router? (recommended) … No / *Yes
✔ Would you like to customize the default import alias?*No / Yes

cd carbon-tutorial-nextjs
yarn dev

Configure paths in jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "@/components/*": ["components/*"],
      "@/app/*": ["app/*"]
   }
  }
}

carbon-tutorial-nextjs's People

Contributors

andreancardona avatar guidari avatar jeremycaine avatar tay1orjones avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

carbon-tutorial-nextjs's Issues

Server error in "Step 2" in "Add landing page grid" step

Description

In the step Add landing page grid of Step 2 of the tutorial just simply adding the import import { Grid, Column } from '@carbon/react'; leads to a Server Error right away. The error gets fixed only by adding 'use client'; to src/app/page.js.

Call stack:

- error node_modules/@carbon/react/lib/internal/usePrefix.js (18:61) @ createContext
- error createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
    at eval (webpack-internal:///(sc_server)/./node_modules/@carbon/react/lib/internal/usePrefix.js:17:63)
    at (sc_server)/./node_modules/@carbon/react/lib/internal/usePrefix.js (/home/stanley/repos/carbon-tutorial-nextjs/.next/server/app/page.js:8866:1)
    at __webpack_require__ (/home/stanley/repos/carbon-tutorial-nextjs/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(sc_server)/./node_modules/@carbon/react/lib/components/Accordion/Accordion.js:12:17)
    at (sc_server)/./node_modules/@carbon/react/lib/components/Accordion/Accordion.js (/home/stanley/repos/carbon-tutorial-nextjs/.next/server/app/page.js:5709:1)
    at __webpack_require__ (/home/stanley/repos/carbon-tutorial-nextjs/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(sc_server)/./node_modules/@carbon/react/lib/index.js:11:17)
    at (sc_server)/./node_modules/@carbon/react/lib/index.js (/home/stanley/repos/carbon-tutorial-nextjs/.next/server/app/page.js:8580:1)
    at __webpack_require__ (/home/stanley/repos/carbon-tutorial-nextjs/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(sc_server)/./src/app/home/page.js:7:71) {
  name: 'TypeError',
  digest: undefined
}
null

image

Reproduce

  1. checkout v11-next-step-2
  2. add import { Grid, Column } from '@carbon/react'; just below use client in src/app/home/page.js
  3. visit http://localhost:3000/

Warning about using defaultProps keeps being thrown when following tutorial

Warning keeps being thrown when following tutorial on the carbon official website

Detailed description

Describe in detail the issue you're having.

I followed the steps shown in the tutorial. When adding the UIShell or any other component, e.g. SideNavIcon, it keeps throwing the following warning:

Warning: SideNavIcon: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Is this a feature request (new component, new icon), a bug, or a general issue?

General Issue

Is this issue related to a specific component?

Looks like an older version of carbon react is being used because this warning has been resolved here, but the version with the fixes isn't being used.

What did you expect to happen? What happened instead? What would you like to see changed?

Get rid of the annoying warnings!

What browser are you working in?

Chrome

Error: Cannot find module 'postcss-import'"

cloned repo -- did steps to set upstream and forked repo in synch -- yarn, yarn build, yarn dev with following output

Failed to compile
./src/app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[4].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[4].oneOf[12].use[3]!./src/app/globals.css
Error: Cannot find module 'postcss-import'
Require stack:

  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/index.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/build/webpack/config/index.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/build/webpack-config.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/server/dev/hot-reloader.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/server/dev/next-dev-server.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/server/next.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/server/lib/render-server.js
  • /Users/rmasonh/Desktop/myProject/carbon-tutorial-nextjs/node_modules/next/dist/compiled/jest-worker/processChild.js
    at Array.map ()
    This error occurred during the build process and can only be dismissed by fixing the error.

Docs: 404 page not found for the tutorial

Detailed description

The Get started link in the repo's readme, pointing to the tutorial instructions (from #24 addition), is leading to a 404 error. It seems that the page at https://carbondesignsystem.com/developing/next-tutorial/overview doesn't exist (yet?) on the main website.

Steps to reproduce the issue

  1. Navigate to https://github.com/carbon-design-system/carbon-tutorial-nextjs.
  2. Click on the tutorial instructions link in the readme.

Additional information

image

Deploying thru vercel.app

Vercel.app deploy missing the repositories and tabs break

Detailed description

looking to get the build setup properly to understand what happens behind the scenes. it is deployed here https://carbon-react-portfolio.vercel.app/

and tabs are not working either at the moment

I do have these things working on the carbon react next tutorial but when I move to my portfolio it breaks.

Just wanting some guidance on the deploy to vercel and best practices to understand the build better.
https://github.com/michelle-currier/carbon-react-portfolio

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.