Skip to content

Commit 17acca2

Browse files
committed
Add gui editor article
1 parent b8f949f commit 17acca2

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/assets/blog/hackts_debug.webp

69.1 KB
Loading

src/content/blog/gui-editor.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "Implementing Custom Figma Designs in Rails"
3+
publishedAt: 2024-08-03
4+
description: "A technical overview of the challenges faced when translating highly customized Figma designs into a Rails application. This article discusses layout issues, the limitations of CSS frameworks like Bootstrap and Tailwind, and suggests a GUI editor design for more efficient component positioning."
5+
tags: ["rails", "css", "figma", "gui-editor"]
6+
---
7+
8+
# Challenges in Implementing the hackts.ch Design
9+
10+
While building the hackts.ch site, I encountered layout issues that I did not anticipate. The design came from a highly customised Figma file with precise alignments, irregular shapes and spacing patterns.
11+
12+
I chose Rails with custom Sass stylesheets because of the abundance of unique styling across the page. [Bootstrap](https://getbootstrap.com/) felt difficult to adapt to the design, and [Tailwind’s utility classes](https://tailwindcss.com/docs/utility-first) were not flexible enough for the level of customisation required.
13+
14+
## The Design Gap
15+
16+
The Figma design did not translate neatly into flexbox or grid layouts with simple gaps, margins and paddings. Inspecting the box model in the browser confirmed that replicating the layout required careful, element-by-element positioning.
17+
18+
![hackts.ch homepage with debug rendering](../../assets/blog/hackts_debug.webp)
19+
20+
*Implementation of hackts.ch with box model inspection, showing the irregular spacing and alignment requirements.*
21+
22+
I also tried using Figma-to-code tools such as [Builder.io’s Figma plugin](https://www.builder.io/c/docs/figma-to-builder), but the generated output fell far short of expectations. The markup was verbose, difficult to maintain, and unsuitable for production.
23+
24+
## Retrospective Approaches
25+
26+
Looking back, several methods might have eased the process:
27+
28+
- Rendering sections as images with defined clickable areas
29+
- Using background images with text overlays
30+
- Exporting directly from Figma as SVGs to keep both vector shapes and text
31+
- Adding overlays for pixel-accurate alignment adjustments
32+
33+
While each could have been useful, all still required manual editing of pixel values.
34+
35+
## A Possible Solution
36+
37+
A more efficient approach would be to build a GUI editor in Rails for placing visual components.
38+
Such an editor could allow drag-and-drop placement of images, text, and overlays directly in the browser. Elements would be placed inside `position: relative` containers, with their coordinates stored in the database. The page rendering could then use these stored values, eliminating the need for repeated CSS edits and manual refreshing.
39+
40+
An implementation could follow ideas from [Herb LSP](https://marcoroth.dev/blog/herb-lsp/), which proposes a language server for HTML and embedded Ruby, but adapted to support real-time visual adjustments to component positions.
41+
42+
## Conclusion
43+
44+
Highly customised designs often make standard frameworks and layout approaches less effective. Even with Sass for flexibility, aligning to the Figma design became a slow, manual process. A Rails-based GUI editor for component positioning could make implementation faster, more accurate, and easier to maintain.

0 commit comments

Comments
 (0)