Skip to content

Commit 59f6b7c

Browse files
authored
Merge pull request #138 from infinum/develop
Version 6 deploy
2 parents b114939 + d97714d commit 59f6b7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+53003
-27004
lines changed

.github/workflows/documentation.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,32 @@ name: documentation
22

33
on:
44
push:
5+
paths-ignore:
6+
- '**.md'
57
branches:
68
- main
9+
- develop
710
# Allow manually triggering the workflow.
811
workflow_dispatch:
912

1013
defaults:
1114
run:
1215
working-directory: ./website
1316

17+
# Cancels all previous workflow runs for the same branch that have not yet completed.
18+
concurrency:
19+
# The concurrency group contains the workflow name and the branch name.
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
1423
jobs:
1524
checks:
1625
runs-on: ubuntu-latest
1726
steps:
1827
- uses: actions/checkout@v1
1928
- uses: actions/setup-node@v1
2029
with:
21-
node-version: '14.x'
30+
node-version: '16.x'
2231
- name: Test Build
2332
run: |
2433
if [ -e yarn.lock ]; then
@@ -31,12 +40,14 @@ jobs:
3140
yarn run build
3241
3342
gh-release:
43+
name: Release docs
44+
if: ${{ github.ref == 'refs/heads/main' }}
3445
runs-on: ubuntu-latest
3546
steps:
3647
- uses: actions/checkout@v1
3748
- uses: actions/setup-node@v1
3849
with:
39-
node-version: '14.x'
50+
node-version: '16.x'
4051
- uses: webfactory/ssh-agent@v0.5.0
4152
with:
4253
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.DS_Store
2+
.idea
3+
.vscode
24

35
node_modules
46

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
<p align="center">
2-
<img alt="Eightshift Frontend Libs" src="https://repository-images.githubusercontent.com/236449101/77ca190e-d3c9-41a3-9f76-2cc04a6bab62"/>
3-
</p>
1+
![image](https://user-images.githubusercontent.com/77000136/146529640-fb4a0dc8-af62-4249-ae05-fa3286b46a22.png#gh-light-mode-only)
2+
![image](https://user-images.githubusercontent.com/77000136/146529660-5a68acb5-e6a3-4634-8603-5c03e52779ea.png#gh-dark-mode-only)
43

54
[![GitHub tag](https://img.shields.io/github/tag/infinum/eightshift-docs.svg?style=for-the-badge)](https://github.com/infinum/eightshift-docs)
65
[![GitHub stars](https://img.shields.io/github/stars/infinum/eightshift-docs.svg?style=for-the-badge&label=Stars)](https://github.com/infinum/eightshift-docs/)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Initial setup and first steps
3+
description: This blog post describes how to set up Eightshift Boilerplate theme, and covers some of the most common issues that may occur
4+
slug: initial-setup
5+
authors: iobrado
6+
tags: [eightshift, boilerplate, setup]
7+
hide_table_of_contents: false
8+
---
9+
As is often the case when trying out something new, you might encounter some hiccups. You're trying out our Eightshift Boilerplate, but can't get it to work? Worry not, we'll go through the setup and the most common issues that may occur.
10+
11+
<!--truncate-->
12+
If you haven't already, be sure to read our official [Eightshift Docs](https://infinum.github.io/eightshift-docs/docs/welcome).
13+
14+
### Setup
15+
16+
To create Eightshift theme, navigate to `wp-content/themes` in your project and type the following in the terminal:
17+
18+
```bash
19+
npx create-wp-project
20+
```
21+
22+
Just follow the instructions and wait for the theme to download.
23+
24+
![Setup - initial prompt](/img/blog/setup-1.png)
25+
26+
OK, you went through the process, filled out all required information, but the theme still isn't working. There are a few more instructions in the terminal on what to do next, but you may have skipped them. While the principle **"6 hours of debugging can save you 5 minutes of reading documentation"** is fun, sometimes it's just not worth it. Here's what you should do:
27+
28+
- run `wp theme activate your-theme-name` to activate your new theme
29+
- navigate to `wp-content/themes/your-theme-name`
30+
- try running `wp boilerplate --help` to check if our WP CLI boilerplate commands work
31+
- for easiest initial setup, run `wp boilerplate setup_theme`
32+
- `npm start` should trigger automatically with the previous command. If it doesn't, you can run it manually to finish the theme build process
33+
34+
![Setup - instructions](/img/blog/setup-2.png)
35+
36+
Congratulations, you've set up your Eightshift theme!
37+
38+
### Getting to know Eightshift dev tools
39+
40+
After successfully setting up the theme and going through files, you'll notice this file structure is quite different from traditional WordPress themes and you may think to yourself: "Oh wow, what did I get myself into?"
41+
42+
While it may look scary and confusing at first, once you get used to the structure, you'll see the benefits. More about that will be covered in future posts, where we'll walk you through some basics of developing with Eightshift Boilerplate.
43+
44+
You may want to try a few of our WP CLI commands to add another component, block, or service class. Running `wp boilerplate --help` will give you a list of commands and their short description. If you need even more details about a specific command, you can type, e.g. `wp boilerplate create_post_type --help`
45+
46+
The final tip in this post is related to troubleshooting. Maybe you tried to add a new class or a new feature to one of the existing blocks. And now the site has crashed. In tech support, the number 1 question is **"Have you tried turning it off and on again?"**. In our case, the number 1 question is:
47+
48+
> Have you tried `composer dump-autoload` and re-running `npm start`?
49+
50+
### What's next in store?
51+
52+
That's all for this post. In future posts we'll go through some more how-to examples like:
53+
- the difference between components and blocks
54+
- downloading components and blocks from our Storybook with WP-CLI
55+
- adding new features to components and blocks
56+
- adding custom fonts to your project
57+
- adding custom queries which we'll use in one of our blocks
58+
- and many more...
59+
60+
So stay tuned.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Components and blocks
3+
description: Explanation of the difference between components and blocks on a practical example
4+
slug: components-and-blocks
5+
authors: iobrado
6+
tags: [eightshift, boilerplate, components, blocks]
7+
hide_table_of_contents: false
8+
---
9+
In this blog post, we'll give you a practical explanation about the difference between components and blocks. For a truly in-depth explanation about components and blocks, you can refer to [our documentation](https://infinum.github.io/eightshift-docs/docs/basics/blocks). A more specific explanation about using components in a block can be found in the [Component in a Block](https://infinum.github.io/eightshift-docs/docs/basics/blocks-component-in-block/) section.
10+
11+
<!--truncate-->
12+
One of the things that is really confusing to newcomers is the difference between components and blocks. Let's break it all down.
13+
14+
### Component
15+
16+
> A component is like a blank slate, a template without context.
17+
18+
It doesn't know or even care for what it will be used. Can you combine multiple simple components into one complex component? Absolutely! That's exactly what we'll do in the following example.
19+
20+
Let's say we have a component that consists of an image and a heading. Image and heading are two simple components that come with the theme out-of-the-box.
21+
22+
Here are a few examples of how this new component can be used:
23+
- displaying a post
24+
- displaying a user or an author
25+
- displaying a photo with the photographer's name
26+
- and many more...
27+
28+
As you can already see, there are many ways you can use this component. What helps expand the usability of this component even more are `attributes`. Let's say we have the following attributes:
29+
- `imagePosition` - left, right, top, bottom
30+
- `imageShape` - rectangular, circular
31+
- `imageWidth` - 25%, 50%, 75%
32+
- `headingColor` - black, blue, red
33+
- `headingSize` - small, medium, large
34+
35+
These attributes give you the option to modify the look of the component, so this specific component can be used for the following:
36+
37+
- **related posts** - rectangular image on the left side, 25% image width, heading takes up the remaining 75%, medium heading colored in blue
38+
- **user avatar** - circular image on the left side, 25% image width, small heading colored in black
39+
- **photo of the day** - rectangular image on the right side which takes 75% width and photographer's name is written in medium blue text
40+
- **featured posts** - rectangular image on top, large heading in red color
41+
42+
![Component with different attributes](/img/blog/components.png)
43+
44+
You can even add conditional logic to your options, e.g. to have the option for `imageWidth` visible only when `imagePosition` is set to left or right. And when `imagePosition` is set to top or bottom, it defaults to 100% width.
45+
46+
### Block
47+
48+
So, what about blocks? Blocks can consist of one or more components and, most importantly, allow you to use them in the editor. Technically, blocks can consist of zero components, but we encourage you to build blocks from components because that increases the reusability.
49+
50+
> Blocks give context to the components.
51+
52+
Now that we have our component - let's call it `card-simple` - we can use it in a `Featured Posts` block. In **component's** `manifest.json`, we've already defined how we want it to look by setting some defaults. When using this component in our block, we can override some attributes in **block's** `manifest.json`. Since it will be used for displaying featured posts, we can define that `imagePosition` should be set to **top**.
53+
54+
After defining how we want our component to look while displaying featured posts, we need another attribute which will allow us to choose which posts to display in our block.
55+
56+
To do that, we'll add a new attribute called `featuredPosts` which will define which posts will be displayed in our block. For each selected post, another `card-simple` component is added, and featured image and post title are dynamically added to its image and heading components. More about the query logic and adding new options in a block will be covered in a future post.
57+
58+
You may be wondering, can you have a block that allows you to use all options of the `card-simple` component? Of course! You can create a block that allows you to set all available options in the editor and manually add content to the image and heading. There are also block variations, which allow you to set up predefined attributes for a block. More about setting up block variations may be covered in one of the future posts.
59+
60+
### Conclusion
61+
62+
Hopefully, these examples helped you get a better understanding of the difference between components and blocks. It may take a bit more time or practical use to understand the difference and reasoning behind it. Our next post will walk you through downloading one of our components and blocks with WP CLI and modifying it.

website/blog/authors.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
iobrado:
2+
name: Igor Obradović
3+
title: WordPress Engineer @ Infinum

website/docs/basics/backend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: backend
3-
title: Backend
3+
title: General
44
---
55

66
[![docs-source](https://img.shields.io/badge/source-eigthshift--libs-blue?style=for-the-badge&logo=php&labelColor=2a2a2a)](https://github.com/infinum/eightshift-libs)

website/docs/basics/basics.md renamed to website/docs/basics/basics-intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
id: basics
2+
id: basics-intro
33
title: Basics
44
---
55

website/docs/basics/blocks-component-in-block.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ For more details please check our helpers sections for [JavaScript](helpers-java
8080
8181
By defining components key in the block registration phase we are drilling down from block to the last component and setting up attribute names according to your setup. In order for everything to work, we had to add/change prefixes to each component attribute in relation to where this attribute is used in the dependency tree. It is not so hard as it sounds so let us show you some graphical examples:
8282

83-
![Attributes 1](/eightshift-docs/img/docs/attributes-1.png)
83+
![Attributes 1](/img/docs/attributes-1.png)
8484

85-
![Attributes 2](/eightshift-docs/img/docs/attributes-2.png)
85+
![Attributes 2](/img/docs/attributes-2.png)
8686

87-
![Attributes 3](/eightshift-docs/img/docs/attributes-3.png)
87+
![Attributes 3](/img/docs/attributes-3.png)
8888

8989
### I want to use one heading component in my block.
9090

website/docs/basics/blocks-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ wp boilerplate use_component --help
7373

7474
It depends. You can't use things from the blocks folder like `components`, `custom`, `variations`, `wrapper`, etc. They are meant to be copied to your project, styled, and changed depending on your project's needs.
7575

76-
You can move things from a block to your project using the commands described in [this chapter](blocks-intro#how-can-i-use-your-pre-made-blocks).
76+
You can move things from a block to your project using the commands described [above](#how-can-i-use-your-pre-made-blocks).
7777

7878
### I want to change attributes on inner blocks. How do I do it?
7979

0 commit comments

Comments
 (0)