Skip to content

Commit 98aad3f

Browse files
authored
Merge pull request #236 from infinum/feature/visual-refresh
Docs visual refresh
2 parents 7ee609a + a89d217 commit 98aad3f

File tree

127 files changed

+9586
-31567
lines changed

Some content is hidden

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

127 files changed

+9586
-31567
lines changed

website/blog/2022-01-20-initial-setup.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ As is often the case when trying out something new, you might encounter some hic
1010

1111
<!--truncate-->
1212

13-
> _**Last updated: 23rd August, 2022**_
13+
:::info Last update
14+
August 23, 2022
15+
:::
1416

1517
If you haven't already, be sure to read our official [Eightshift Docs](/docs/welcome).
1618

@@ -48,7 +50,9 @@ You may want to try a few of our WP CLI commands to add another component, block
4850

4951
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:
5052

51-
> Have you tried `composer dump-autoload` and re-running `npm start`?
53+
:::tip
54+
Have you tried `composer dump-autoload` and re-running `npm start`?
55+
:::
5256

5357
## What's next in store?
5458

website/blog/2022-01-21-components-and-blocks.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ One of the things that is really confusing to newcomers is the difference betwee
1313

1414
## Component
1515

16-
> A component is like a blank slate, a template without context.
16+
:::note :es-hide-title:
17+
A component is like a blank slate, a template without context.
18+
:::
1719

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.
20+
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.
1921

2022
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.
2123

@@ -47,7 +49,9 @@ You can even add conditional logic to your options, e.g. to have the option for
4749

4850
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.
4951

50-
> Blocks give context to the components.
52+
:::note :es-hide-title:
53+
Blocks give context to the components.
54+
:::
5155

5256
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**.
5357

website/blog/2022-03-03-adding-blocks-wpcli.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ date: 2022-03-14
77
tags: [eightshift, boilerplate, wpcli, components, blocks]
88
hide_table_of_contents: false
99
---
10-
Although there are a few basic blocks available after creating a project, there are a lot more blocks available in the dev kit. However, you have to add them to your project using WP-CLI (the simplest method). To see the complete list of available components and blocks, visit our [Storybook](/storybook).
10+
Although there are a few basic blocks available after creating a project, there are a lot more blocks available in the dev kit. However, you have to add them to your project using WP-CLI (the simplest method). To see the complete list of available components and blocks, visit our [Storybook](/storybook).
1111

1212
These can be used out-of-the-box, but also as a good starting point if you need similar blocks in your projects. It will also speed up your development time since you don't have to build everything from scratch.
1313

1414
<!--truncate-->
1515

16-
> _**Last updated: 23rd August, 2022**_
16+
:::info Last update
17+
August 23, 2022
18+
:::
1719

1820
## Storybook
1921

website/blog/2022-03-04-modifying-blocks.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ For editors to be able to choose which color theme to use for the Quote block, w
7777
}
7878
```
7979

80-
> Double-check the path of the manifest used in this example. We're adding it inside the Quote component manifest, not the Quote block manifest.
80+
:::caution
81+
Double-check the path of the manifest used in this example. We're adding it inside the Quote component manifest, not the Quote block manifest.
82+
:::
8183

8284
After that, since we want to have a fixed number of options, we need to define available options. We can do that inside `options` which is on the same level as `attributes`:
8385
```json
@@ -193,7 +195,9 @@ $unique = Components::getUnique();
193195
//...
194196
```
195197
196-
> Both PHP and JS have the same helpers to make writing code for editor and front view as similar as possible.
198+
:::note
199+
Both PHP and JS have the same helpers to make writing code for editor and front view as similar as possible.
200+
:::
197201
198202
## Adding options
199203
After adding these snippets, you should already see that your block is using the blue color theme, which we defined as the default value for `quoteColorTheme` in the manifest. We want to have an easy way to change the color theme in the editor. Now we'll add a new option which will do just that.

website/blog/2022-04-08-adding-fonts.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Every project is unique. Logo, colors, fonts, etc. are what define the visual id
1818
- [Everything Fonts](https://everythingfonts.com/ttf-to-woff)
1919
- [Transfonter](https://transfonter.org/)
2020

21-
> Just make sure you have the proper license for the fonts you are converting.
21+
:::caution Warning
22+
Make sure you have the proper license for the fonts you are converting.
23+
:::
2224

2325
Fonts should go inside your theme's **_/assets/fonts_** folder. Copy the fonts you want to use there. You will also notice that this folder contains an **_index.js_** file, used to import fonts into your project. Here's an example of how I imported my fonts:
2426
```js
@@ -51,7 +53,9 @@ import './NotoSerif-Italic.woff2';
5153
import './NotoSerif-Regular.woff2';
5254
```
5355

54-
> If you don't need to support IE11, don't include `.woff` files. This will save you some bandwidth.
56+
:::tip
57+
If you don't need to support IE11, don't include `.woff` files. This will save you some bandwidth.
58+
:::
5559

5660
To add these fonts as your base font and secondary font, go to the global manifest located in **_/src/Blocks_** and add the following inside `globalVariables`:
5761
```json

website/blog/2022-04-25-using-assets.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ The filter we are using is called `manifest-item` and we use it to get the URL o
3131

3232
You can see how this is being used for rendering both favicon and header logo in your theme's **_header.php_** file.
3333

34-
> **Tip**: Don't hardcode the filter name in the `apply_filters` function. Always call it via class constants.
34+
:::tip
35+
Don't hardcode the filter name in the `apply_filters` function. Always call it via class constants.
36+
:::
3537

3638
For better organization, you can add additional folders (e.g. **_icons_**, **_placeholders_**) inside the **_assets/images_** folder. Here's an example of how to include them:
3739

@@ -48,7 +50,9 @@ import './placeholders/page.png';
4850

4951
If you recall from a previous blog post about [Modifying Blocks](/blog/modifying-blocks-color-theme), you might have already seen an alternative approach to including SVG files in your block or component.
5052

51-
> If you don't have it in your project, be sure to read our blog post about adding blocks and components by using [WP CLI](/blog/adding-blocks-wpcli).
53+
:::info :es-hide-title:
54+
If you don't have it in your project, be sure to read our blog post about adding blocks and components by using [WP CLI](/blog/adding-blocks-wpcli).
55+
:::
5256

5357
Open **_src/Blocks/components/quote/manifest.json_** and you'll see that the icon used by the component is defined inside `resources` as a key-value pair. Key represents the name that we will use to fetch the icon, while the value is SVG code.
5458

website/blog/2022-05-10-acf-in-a-project.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class IntroAcfMeta extends AbstractAcfMeta
6060
* Intro field name.
6161
*/
6262
public const INTRO_FIELD_NAME = 'intro';
63-
63+
6464
/**
6565
* Render acf fields.
6666
*
@@ -104,7 +104,9 @@ if (function_exists('get_field')) {
104104
}
105105
```
106106

107-
> It's better to use class constants because if you decide to change the field name, you will have to change it only in one place.
107+
:::tip
108+
It's better to use class constants because if you decide to change the field name, you will have to change it only in one place.
109+
:::
108110

109111
## Theme Options
110112

website/blog/2022-09-07-block-variations.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Let's picture the following scenario: You just created a block with many options
1515

1616
Block variations allow us to override default block attributes. We can select a variation from the block list with all preset options instead of manually setting them.
1717

18-
> Please note that you cannot add new attributes in variations. Only attributes that exist in the parent block can be used.
18+
:::note
19+
You cannot add new attributes in variations. Only attributes that exist in the parent block can be used.
20+
:::
1921

2022
For example, we have a `Card` block. If we want to use it for something like downloading PDF files, we may not need image or paragraph components. A simple text that describes type of the file, title of the file and a download button are all we need in this case.
2123

@@ -61,7 +63,9 @@ Other than overriding default attributes with variations, you can do much more w
6163

6264
The following example is very basic, but it will give you an idea of how to provide inner block data. It can easily be reproduced with our `Carousel` block if you want to try it yourself.
6365

64-
> If you don't have Carousel block in your project yet, you can add it with the following WP-CLI command: `wp boilerplate blocks use-block --name="carousel"`
66+
:::note
67+
If you don't have Carousel block in your project yet, you can add it with the following WP-CLI command: `wp boilerplate blocks use-block --name="carousel"`
68+
:::
6569

6670
Once you have the `Carousel` block up and running, create a variation called `Carousel Loop`. For this variation, we want the following:
6771
- loop

website/blog/2022-12-13-using-cpts-and-taxonomies.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ For this exercise, we'll create a new post type called `Projects`. To make the p
2323
wp boilerplate create post-type --label='Project' --plural_label='Projects' --slug='project' --rewrite_url='project' --rest_endpoint_slug='projects'
2424
```
2525

26-
> If your new CPT is not working, try flushing rewrite rules by re-saving the settings in **Settings -> Permalinks** or by using `wp cache flush` CLI command
26+
:::tip
27+
If your new CPT is not working, try flushing rewrite rules by re-saving the settings in **Settings -> Permalinks** or by using `wp cache flush` CLI command
28+
:::
2729

2830
Your new post type is registered and ready to use! Easy, right?
2931

website/docs/basics/autowiring.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,19 @@ This works out of the box, but you shouldn't really do this.
8181

8282
A good coding practice is that your class should never depend on the concrete class implementation because you have tightly coupled your class to another class. This makes it hard to test and your code becomes hard to modify. Imagine that you have put a concrete implementation as a dependency, only to get feedback from the client that you need to change that implementation for a completely different one. Making the changes means that you'll need to track all the places in your codebase where you have used some functionality from this class, and change it completely.
8383

84-
> You should always code against interfaces and not implementation.
84+
:::success Good practices
85+
You should always code against interfaces and not implementation.
86+
:::
8587

8688
We can't stress this enough because as your project grows, so will your headaches. Also, when you start testing your code, that is when your hair will begin to fall off. We recommend reading Uncle Bob Martin's [Clean Code](http://cleancoder.com/products). That will save you a lot of sleepless nights, and you'll learn tons of tips and tricks for writing clean code.
8789

8890
### What if my class has an interface parameter inside the constructor method?
8991

9092
This will automatically be resolved (same as with class parameters) if you follow one simple rule:
9193

92-
> Variable name in your constructor method needs to match the class name (which implements the interface) in camelCase.
94+
:::caution Important
95+
Variable name in your constructor method needs to match the class name (which implements the interface) in camelCase.
96+
:::
9397

9498
For example, let's say you have a `SteeringWheel` class:
9599

0 commit comments

Comments
 (0)