Building the block-based news section
The news section had to support several types of content within a single page. These included rich text, privacy terms, code, quotes, images with captions, game screenshots, game features, company values, benefits, and games.
At the center of the structure was the ContentBlock interface with a type field. Each block implemented this interface, defined its own type, and stored the data it required. For example, the rich-text block contained its type, label, and content.
We created a separate visual component for every block type to make data entry easier. Inside the component, each block was treated as a separate state that could be edited and saved. The components also included buttons for changing the order of blocks within the container.
To store the content, we used a JsonObject mapped to a Java class. When the page was saved, the application collected the states of all blocks, combined them into an array, and saved the result in a table field. This gave us a flexible system in which each material could be assembled from the required blocks.
The block editor was one part of the wider Belka Games website project. The visual direction used a coral palette on a light background, black accents, and playful typography to reflect the character of the gaming company. The design and development context is available in the Belka Games case study.