Skip to content

This project is based on Sitecore's official Next.js headstart solution, but dressed up with TailwindCSS.

Notifications You must be signed in to change notification settings

frheinze/headstart-nextjs

 
 

Repository files navigation

Introduction

In general for me the Sitecore's Next.js headstart solution fits perfectly for a quick start after the Getting Started journey of OrderCloud. In my opinion, the barrier to entry is significantly lower than that of the official headstart solution. Especially since you don't have to worry about Azure infrastructure, initial seeding and middleware right from the beginning - and it's built on React ;)

Why this fork?

This solution is based on Sitecore's Next.js headstart solution, but dressed up with TailwindCSS. So if you're interested in setup and implementation details of the solution, please check the official readme first.

The purpose of this fork is to have more fun working with Sitecore's Next.js solution:

  • It's prettier.
  • A few small bugs are fixed.
  • You can customize some basics (see below).

But I wouldn't consider this solution as a headstart solution (neither is the original by the way), it's more a playground for small demo projects or proof of concepts.

Why TailwindCSS?

For me as a backend developer it is easy to use. In a few hours I've implemented some pages and modules and put a theme over it.

The principle of doing styling directly in the markup based on predefined classes of the framework is very effective and requires little familiarization with project specific CSS classes.

It's well documented and seems to have a great community:

Preview

Let's have a look at the new design: Preview

For comparison the link to the official Next.js demo from Sitecore.

Design changes

The following pages were already styled with TailwindCSS:

  • /home
  • /products
  • /search
  • /product/[id]
  • Basics only:
    • /login
    • /cart
    • /checkout

Functional modifications

The following features were implemented in addition to those of Sitecore:

  • The display of (color) spec options in list views has been made possible.
  • Price calculation at the level of a product (variant) has been implemented (based on price calculation of Angualar headstart solution of Sitecore OrderCloud).
  • The currency to be displayed was made configurable.

Getting Started

First of all, please check this part of the official readme.

Customize your demo shop

Theming

Navigation

You can edit the main navigation in /ordercloud/components/baselayout/OcHeader/index.tsx.

I18N

You can edit the price format or the currency in shopconfig.json. If you are not sure which values are valid, have a look at the documentation of Intl.NumberFormat.

Product configuration

Images

To make the demo shop look even better, you should maintain a few product images. For this you need to add the following properties to the product:

"xp": {
  "images": [
    {
      "url": "https://tailwindui.com/img/ecommerce-images/product-page-03-product-01.jpg",
      "alt": "First bag"
    },
  ]
}

Color specs (optional)

I have implemented the possibility to buy products in different colors (product specs or variants). If you want to use this feature, you have to add the following properties to specs:

"xp": {
  "Type": "Color"
}

and spec options:

"xp": {
  "cssColor": "bg-red-600"
}

If you do not use these CSS classes anywhere else, then you must add them to the tailwind.config.js safelist. Otherwise Tailwind will optimize them away, see https://v2.tailwindcss.com/docs/optimizing-for-production#safelisting-specific-classes.

Attention: For new spec options you always have to generate the product variants first!

Product facets (optional)

If you like to use the product search, you need to configure product facets in OrderCloud. As you can see in /pages/search.tsx I've prepared the following facets (and of cause you can edit them):

  'xp.colors': 'color',
  'xp.is_new': 'is_new',

About

This project is based on Sitecore's official Next.js headstart solution, but dressed up with TailwindCSS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.9%
  • JavaScript 2.0%
  • CSS 0.1%