Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Dec 30, 2024
1 parent 992d234 commit 8228d2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions docs/source/blocks/examples/customschemaandview.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ We can create a block with several settings defined using a schema, and let Volt

What we need to do is to define the schema, the view component, and configure the block settings.

## Preparation
## Preparations

In your volto addon, create a folder inside the {file}`components` folder to save all the files required to create a block.

Name this folder as {file}`ExampleBlock`.

## Schema

Create a {file}`schema.js` inside the {file}`ExampleBlock` folder, with the following contents:
Create a {file}`Schema.js` file inside the {file}`ExampleBlock` folder, with the following contents:

```js
import messages from './messages';
Expand Down Expand Up @@ -101,8 +101,8 @@ import React from 'react';

const View = (props) => {
// data holds the values entered in the block edit form
// className holds the CSS class names injected to this block by other Volto features
// style holds the CSS properties injected to this block by other Volto featured
// className holds the CSS class names injected to this block by Volto's `styleClassNameExtenders`
// style holds the CSS properties injected to this block by Volto's `Block Sytle Wrapper`
const { data, className, style } = props;
return (
<div className={cx('block', 'block02', className)} style={style}>
Expand Down Expand Up @@ -157,6 +157,12 @@ On the top of the file you will need to import the relevant components, as follo
import View02 from './components/ExampleBlock/View';
import Schema02 from './components/ExampleBlock/Schema';

// This is the icon we use for the example, use a meaningful one or provide your own image.
import imagesSVG from '@plone/volto/icons/images.svg';
```

## See it in action

```
Your block is ready to be used in your site.

Restart your Volto site and you will be able to add it using the block add form.
2 changes: 1 addition & 1 deletion docs/source/blocks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ block-style-wrapper
extensions
ssr
core/index
examples
examples/index
```

0 comments on commit 8228d2d

Please sign in to comment.