defmodule ChesstrainerWeb.Board.SquareComponent do @moduledoc """ Renders a single chess square with optional piece and highlighting. """ use Phoenix.Component import ChesstrainerWeb.Board.PieceComponent attr :file, :atom, required: true attr :rank, :integer, required: true attr :piece, :any, default: nil attr :files_list, :list, required: true attr :move_from_square, :any, default: nil attr :myself, :any, required: true def square(assigns) do current_square = {assigns.file, assigns.rank} assigns = assigns |> assign(:highlight_square, current_square === assigns.move_from_square) ~H"""