berrypod/lib/simpleshop_theme/theme/presets.ex
Jamey Greenwood a401365943 feat: add Settings and Media contexts with theme settings schema
- Create settings table for site-wide key-value configuration
- Create images table for BLOB storage of logo/header images
- Add Setting schema with JSON/string/integer/boolean support
- Add ThemeSettings embedded schema with all theme options
- Add Settings context with get/put/update operations
- Add Media context for image uploads and retrieval
- Add Image schema with SVG detection and storage
- Add 9 curated theme presets (gallery, studio, boutique, etc.)
- Add comprehensive tests for Settings and Media contexts
- Add seeds with default Studio preset
- All tests passing (29 tests, 0 failures)
2025-12-30 21:35:52 +00:00

136 lines
2.8 KiB
Elixir

defmodule SimpleshopTheme.Theme.Presets do
@moduledoc """
Defines the 9 curated theme presets for SimpleShop.
"""
@presets %{
gallery: %{
mood: "warm",
typography: "editorial",
shape: "soft",
density: "spacious",
grid_columns: "3",
header_layout: "centered",
accent_color: "#e85d04"
},
studio: %{
mood: "neutral",
typography: "clean",
shape: "soft",
density: "balanced",
grid_columns: "4",
header_layout: "standard",
accent_color: "#3b82f6"
},
boutique: %{
mood: "warm",
typography: "classic",
shape: "soft",
density: "balanced",
grid_columns: "3",
header_layout: "centered",
accent_color: "#b45309"
},
bold: %{
mood: "neutral",
typography: "modern",
shape: "sharp",
density: "compact",
grid_columns: "4",
header_layout: "standard",
accent_color: "#dc2626"
},
playful: %{
mood: "neutral",
typography: "friendly",
shape: "pill",
density: "balanced",
grid_columns: "4",
header_layout: "standard",
accent_color: "#8b5cf6"
},
minimal: %{
mood: "cool",
typography: "minimal",
shape: "sharp",
density: "spacious",
grid_columns: "2",
header_layout: "minimal",
accent_color: "#171717"
},
night: %{
mood: "dark",
typography: "modern",
shape: "soft",
density: "balanced",
grid_columns: "4",
header_layout: "standard",
accent_color: "#f97316"
},
classic: %{
mood: "warm",
typography: "classic",
shape: "soft",
density: "spacious",
grid_columns: "3",
header_layout: "standard",
accent_color: "#166534"
},
impulse: %{
mood: "neutral",
typography: "impulse",
shape: "sharp",
density: "spacious",
grid_columns: "3",
header_layout: "centered",
accent_color: "#000000",
font_size: "medium",
heading_weight: "regular",
layout_width: "full",
button_style: "filled",
card_shadow: "none",
product_text_align: "center"
}
}
@doc """
Returns all available presets.
## Examples
iex> all()
%{gallery: %{...}, studio: %{...}, ...}
"""
def all, do: @presets
@doc """
Gets a preset by name.
## Examples
iex> get(:gallery)
%{mood: "warm", typography: "editorial", ...}
iex> get(:nonexistent)
nil
"""
def get(preset_name) when is_atom(preset_name) do
Map.get(@presets, preset_name)
end
@doc """
Lists all preset names.
## Examples
iex> list_names()
[:gallery, :studio, :boutique, :bold, :playful, :minimal, :night, :classic, :impulse]
"""
def list_names do
Map.keys(@presets)
end
end