✨ Gorgeous ✨

Gorgeous is a server-side rendering library for Go, inspired by React and Flutter.

The following is a code comparison between the title component on this page and the equivalent component in React.

// pageTitle.go
package components

import (
	g "github.com/zaptross/gorgeous"
	p "github.com/zaptross/gorgeous/example/internal/provider"
)

type PageTitleProps struct {
	Title string
	Id    string
}

func PageTitle(props PageTitleProps) *g.HTMLElement {
	theme := p.ThemeProvider.GetTheme()

	return g.H1(g.EB{
		Children: g.CE{
			g.Text(props.Title),
		},
		Style: g.CSSProps{
			"color":   theme.Base2,
			"margin":  "0 0",
			"padding": "0.67em 0.67em",
		},
		Id: props.Id,
	})
}
// pageTitle.tsx
import react from 'react';
import { useTheme } from '../provider/themeProvider';

type Props = {
  title: string;
  id: string;
};

export function PageTitle({ title, id }: Props) {
  const { theme } = useTheme();

  const style = {
    color: theme.Base2,
    margin: '0 0',
    padding: '0.67em 0.67em',
  };

  return (
    <h1 style={style} id={id}>
      {title}
    </h1>
  );
}

It's still in early development, but you can check out the source code for this page on GitHub 🡕.