Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Docs: Expand layout/theme sections docs

Damian Legawieca83aa64f6f30
diff --git a/docs/developer/storefront/sections.mdx b/docs/developer/storefront/sections.mdx
index 31d2d64596..1c0759fe57 100644
--- a/docs/developer/storefront/sections.mdx
+++ b/docs/developer/storefront/sections.mdx
@@ -3,6 +3,8 @@ title: "Sections"
description: "Learn how to utilize sections to build your Spree Storefront"
---
+## Quick Start
+
Sections are the building blocks of all pages in Spree Storefront.
There are two types of sections:
@@ -21,25 +23,38 @@ There are two types of sections:
Let's take a look at the page structure of Spree Storefront:
-<Frame>
<img src="/images/developer/storefront/page_structure.png" />
-</Frame>
+
As you can see, the page is divided into sections. Each section is a component that is used to create the page.
Most sections are containers that consist of multiple blocks which you can manage via the Page Builder (add/customize/remove/change their order).
+Each section consists of:
+
+| File | Description | Example |
+|------|-------------|---------|
+| ActiveRecord model | Defines the section's preferences | [Spree::PageSections::ImageWithText](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/image_with_text.rb) |
+| Storefront view | Renders the section in the storefront - each theme can have its own view | [image_with_text.html.erb](https://github.com/spree/spree/blob/main/storefront/app/views/themes/default/spree/page_sections/_image_with_text.html.erb) |
+| Admin page builder form | Configures the section in the admin panel | [image_with_text/_form.html.erb](https://github.com/spree/spree/blob/main/admin/app/views/spree/admin/page_sections/forms/_image_with_text.html.erb) |
+
## Layout Sections
We have two types of layout sections - Header and Footer. As the name suggests, they are rendered at the top and bottom of the page respectively. Between them, we have a main content area that is used to render the page sections.
### Header sections
-#### [Announcement Bar](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/announcement_bar.rb)
+#### Announcement Bar
<Frame>
<img src="/images/developer/storefront/announcement_bar.png" />
</Frame>
-#### [Header](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/header.rb)
+A simple announcement bar section that displays a message to the users.
+
+* [Announcement Bar model](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/announcement_bar.rb)
+* [Announcement Bar view](https://github.com/spree/spree/blob/main/storefront/app/views/themes/default/spree/page_sections/_announcement_bar.html.erb)
+* [Announcement Bar form](https://github.com/spree/spree/blob/main/admin/app/views/spree/admin/page_sections/forms/_announcement_bar.html.erb)
+
+#### Header
<Frame>
<img src="/images/developer/storefront/header.png" />
@@ -49,20 +64,35 @@ Header is one of the most important sections in the storefront. It is used to di
Header can have a simple one-level navigation menu or a more complex multi-level menu (aka mega menu)
+* [Header model](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/header.rb)
+* [Header view](https://github.com/spree/spree/blob/main/storefront/app/views/themes/default/spree/page_sections/_header.html.erb)
+* [Header form](https://github.com/spree/spree/blob/main/admin/app/views/spree/admin/page_sections/forms/_header.html.erb)
+
### Footer sections
-#### [Newsletter](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/newsletter.rb)
+#### Newsletter
<Frame>
<img src="/images/developer/storefront/newsletter.png" />
</Frame>
-#### [Footer](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/footer.rb)
+A newsletter section that allows users to subscribe to the store's newsletter. If you connected your store to a newsletter provider (eg. Klaviyo, Mailchimp, etc.), you can use this section to collect emails and send them to your provider (Only in Spree 5.1+).
+
+* [Newsletter model](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/newsletter.rb)
+* [Newsletter view](https://github.com/spree/spree/blob/main/storefront/app/views/themes/default/spree/page_sections/_newsletter.html.erb)
+* [Newsletter form](https://github.com/spree/spree/blob/main/admin/app/views/spree/admin/page_sections/forms/_newsletter.html.erb)
+
+#### Footer
<Frame>
<img src="/images/developer/storefront/footer.png" />
</Frame>
+Footer is a section that is used to display the store's footer. It is typically used to display the store's logo, copyright information, store policies, and other important links.
+
+* [Footer model](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/footer.rb)
+* [Footer view](https://github.com/spree/spree/blob/main/storefront/app/views/themes/default/spree/page_sections/_footer.html.erb)
+* [Footer form](https://github.com/spree/spree/blob/main/admin/app/views/spree/admin/page_sections/forms/_footer.html.erb)
## Content Sections
@@ -70,11 +100,7 @@ Header can have a simple one-level navigation menu or a more complex multi-level
## Architecture
-Each section consists of:
-
-- ActiveRecord model, eg. [Spree::PageSections::ImageWithText](https://github.com/spree/spree/blob/main/core/app/models/spree/page_sections/image_with_text.rb)
-- Storefront view (to render the section in the storefront), eg. [app/views/themes/default/spree/page_sections/image_with_text.html.erb](https://github.com/spree/spree/blob/main/storefront/app/views/themes/default/spree/page_sections/_image_with_text.html.erb)
-- Admin page builder form (to configure the section in the admin panel), eg. [app/views/spree/admin/page_sections/image_with_text/_form.html.erb](https://github.com/spree/spree/blob/main/admin/app/views/spree/admin/page_sections/forms/_image_with_text.html.erb)
+Let's dive into the details of how sections work.
### Active Record Model
diff --git a/docs/docs.json b/docs/docs.json
index 3ed3b4cba5..24579d4e3e 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -1,7 +1,7 @@
{
"$schema": "https://mintlify.com/docs.json",
"name": "Spree Commerce documentation",
- "theme": "maple",
+ "theme": "mint",
"colors": {
"primary": "#0A2242",
"light": "#D7DFE9",