### Basic Setup for Surface Component Testing Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md Provides the basic setup for testing Surface components using `Surface.LiveViewTest` and `Phoenix.LiveViewTest`. It includes necessary imports and defines the default endpoint. ```elixir defmodule MyAppWeb.ButtonTest do use MyAppWeb.ConnCase import Phoenix.LiveViewTest import Surface.LiveViewTest # Import Surface macros # Default endpoint for tests @endpoint MyAppWeb.Endpoint end ``` -------------------------------- ### JSON: Bulma CSS NPM Setup Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md Shows the `package.json` dependency configuration for installing the Bulma CSS framework via NPM. ```JSON { "dependencies": { "bulma": "^0.9.3" } } ``` -------------------------------- ### Install Surface UI Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md Instructions for adding the Surface UI dependency to a Phoenix project's mix.exs file and fetching dependencies. ```elixir def deps do [ {:surface, "~> 0.12.1"} ] end ``` -------------------------------- ### Configure Web Module Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md Example of importing Surface into the web module configuration in lib/my_app_web.ex. ```elixir # lib/my_app_web.ex def view do quote do # ... other imports import Surface end end ``` -------------------------------- ### Elixir: Render Home Page with Surface Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md Defines the `home` function in `MyAppWeb.PageHTML` module to render a hero section with a welcome message and a 'Get Started' button using Surface's templating. ```Elixir defmodule MyAppWeb.PageHTML do use MyAppWeb, :html import Surface def home(assigns) do ~F"""
Content
<:footer>Content
" assert html =~ "" end ``` -------------------------------- ### Elixir Surface Component Definition Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md Provides a basic example of defining a Surface component in Elixir. It shows how to use `use Surface.Component`, define properties (`prop`), slots, and the `render/1` function using the `~F` sigil. ```elixir defmodule Button do use Surface.Component @doc "The button type (color)" prop type, :string, values: ["primary", "success", "info"] @doc "The button is expanded (full width)" prop expanded, :boolean, default: false @doc "Triggered on click" prop click, :event @doc "Triggered on focus" prop focus, :event @doc "The button content" slot default, required: true def render(assigns) do ~F""" """ end end ``` -------------------------------- ### Surface Component with Slots Source: https://github.com/lucas-stellet/surface-ui-docs/blob/main/docs.md An Elixir example defining a Surface component that uses slots for header content and default content, rendering them within a structured layout. ```elixir # components/card.ex defmodule Card do use Surface.Component slot header slot default, required: true def render(assigns) do ~F"""